1

我正在尝试使用 Keyv,遵循本教程:https ://discordjs.guide/keyv/#command-handler并且我也在使用命令处理程序代码。

在我的index.js中,我运行这样的东西:(当然使用适当的 Keyv 导入)

const Keyv = require('keyv');
const mykeyv = new Keyv('redis://user:pass@localhost:6379');
client.on('message', message =>{
    ...//skipping some command handler stuff 
    command.execute(message, args, mykeyv)
})

然后当我运行它时,我最初得到正确和预期的client.on('ready')消息,但是在弹出以下错误几秒钟后:

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Emitted 'error' event on Keyv instance at:
    at KeyvRedis.<anonymous> (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\keyv\src\index.js:43:44)
    at KeyvRedis.emit (events.js:315:20)
    at Redis.<anonymous> (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\@keyv\redis\src\index.js:17:38)
    at Redis.emit (events.js:315:20)
    at Redis.silentEmit (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\ioredis\built\redis\index.js:499:26)
    at Socket.<anonymous> (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\ioredis\built\redis\event_handler.js:186:14)
    at Object.onceWrapper (events.js:422:26)
    at Socket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6379
}

我不确定这个错误是关于什么的,有人可以帮助我吗?

4

0 回答 0