【发布时间】:2021-10-12 16:53:18
【问题描述】:
所以我已经在 heroku 上托管了我的机器人一段时间了,它工作得很好,但我最近又临时搬到了自我托管,因为我必须更新到 discord.js v13,但现在我已经完成了有了这些更改,我尝试在 heroku 上重新托管机器人,但它给出了这个错误:
(node:4) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
2021-08-08T20:30:17.770796+00:00 app[Worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:172:15)
2021-08-08T20:30:17.770796+00:00 app[Worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:176:19)
2021-08-08T20:30:17.770797+00:00 app[Worker.1]: at RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:50:25)
2021-08-08T20:30:17.770797+00:00 app[Worker.1]: at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-08-08T20:30:17.770798+00:00 app[Worker.1]: at async WebSocketManager.connect (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:128:9)
2021-08-08T20:30:17.770798+00:00 app[Worker.1]: at async Client.login (/app/node_modules/discord.js/src/client/Client.js:245:7)
2021-08-08T20:30:17.770799+00:00 app[Worker.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-08-08T20:30:17.770962+00:00 app[Worker.1]: (node:4) 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: 2)
2021-08-08T20:30:17.771045+00:00 app[Worker.1]: (node:4) [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.
我不明白发生了什么,我认为唯一可能导致这种情况的变化是我创建了一个事件处理程序,我现在将事件放在他们自己的文件中,如命令,但我不确定是否这样与此错误有关,我真的希望您能提供帮助。
【问题讨论】:
-
这个问题正是我的问题,但它建议更新到节点 16.6,我已经这样做了,不幸的是我现在无法检查,但我很确定我应该有正确的节点版本
-
您可以通过在终端中运行
node -v来检查您的节点版本。
标签: javascript node.js heroku discord discord.js