节点:事件:492 抛出错误; // 未处理的“错误”事件

问题描述 投票:0回答:1

我厌倦了安装从 github 获取的机器人,但无法工作,我不知道问题出在哪里,请检查错误并帮助我

https://github.com/lefdilia/Axabot

注意:我是 Nodejs 新手

--我的电脑终端--

PS C:\Users\LoorD\Axabot\_init> npm install
                                
up to date, audited 112 packages in 3s
8 packages are looking for funding
  run `npm fund` for details

6 vulnerabilities (3 high, 3 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
PS C:\Users\LoorD\Axabot\_init> npm start

> [email protected] start
> node _install.js


[1] New Server Install ( To setup newly bought servers )
[2] Bot Only (Fresh install of Axabot [FILES ONLY])
[0] CANCEL

Please choose install type? [1, 2, 0]: 1
* Ip Address : xxx.xxx.xxx.xxx
* Username : root
* Password : ********
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'C:\tmp\rsync_pass'
Emitted 'error' event on WriteStream instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\tmp\\rsync_pass'
}

Node.js v20.10.0
PS C:\Users\LoorD\Axabot\_init> 

--我的服务器终端--

qweasd@Axabot:~$ suPassword:root@Axabot:/home/qweasd#
apt-get install rsync
Reading package lists... DoneBuilding dependency tree... DoneReading state information... Donersync is already the newest version (3.2.7-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.root@Axabot:/home/qweasd#

我按照教程做了,除了使用 Debian 12 64 位然后使用 Debian 9 64 位作为教程

javascript node.js github node-modules nodes
1个回答
0
投票

您在 Node.js 应用程序中似乎遇到了“ENOENT”(Error NO ENTry)错误。 当程序尝试访问不存在的文件或目录时,会出现此错误。 在你的情况下,文件'C:mp 找不到sync_pass'。

验证文件'C:mp “sync_pass”实际上存在于指定位置。

const fs = require('fs');

const filePath = 'C:\\tmp\\rsync_pass';

try {
    // Check if the file exists
    if (fs.existsSync(filePath)) {
        // Proceed with file operations
        console.log(`File found: ${filePath}`);
    } else {
        throw new Error(`File not found: ${filePath}`);
    }
} catch (error) {
    console.error(`Error: ${error.message}`);
}

检查此代码。 这将解决您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.