【发布时间】:2020-06-15 03:31:16
【问题描述】:
我最近在我的个人电脑上用 nodejs 和 discord.js-commando 编写了一个不和谐机器人,它在 Windows 上运行得很好,但我试图把它放在我的树莓派 3b 上,我安装了最新版本的 nodejs,我用过scp 传输文件试图运行机器人,但它只是给了我这个错误:
(node:2609) UnhandledPromiseRejectionWarning: TypeError: this.fetchUser is not a function
at CommandoClient.<anonymous> (/home/pi/bot/node_modules/discord.js-commando/src/client.js:84:11)
at Object.onceWrapper (events.js:417:28)
at CommandoClient.emit (events.js:323:22)
at WebSocketManager.triggerClientReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:433:17)
at WebSocketManager.checkShardsReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:417:10)
at WebSocketShard.<anonymous> (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:199:14)
at WebSocketShard.emit (events.js:311:20)
at WebSocketShard.checkReady (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:466:12)
at WebSocketShard.onPacket (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:438:16)
at WebSocketShard.onMessage (/home/pi/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
(node:2609) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2609) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我真的认为这与 discord.js-commando 包有关,但我不确定。
【问题讨论】:
-
Discord.js 最近几天一直在推送更新。他们推出了 4 个不同的版本。确保您的 Windows PC 运行与您的 pi 相同的版本,因为他们更新的某些版本有很多错误。在过去的 9 个月中,它们一直在 11.5.1 上,您可以在最坏的情况下使用
npm install discord.js@11.5.1将其重新安装到您的 pi。 -
确实使用较新版本的 discord.js 导致它这样做!非常感谢。
-
@Hedip 你能解决这个问题吗?
标签: javascript node.js raspberry-pi3 discord.js