久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Discord bot 不是從 heroku 開始的

Discord bot not starting with heroku(Discord bot 不是從 heroku 開始的)
本文介紹了Discord bot 不是從 heroku 開始的的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

所以我已經在 heroku 上托管了我的機器人一段時間了,它工作得很好,但我最近又臨時搬到了自我托管,因為我必須更新到 discord.js v13,但現在我已經完成了有了這些更改,我嘗試在 heroku 上重新托管機器人,但它給出了這個錯誤:

(node:4) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined2021-08-08T20:30:17.770796+00:00 app[Worker.1]: 在 RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:172:15)2021-08-08T20:30:17.770796+00:00 app[Worker.1]: 在 RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:176:19)2021-08-08T20:30:17.770797+00:00 app[Worker.1]: 在 RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:50:25)2021-08-08T20:30:17.770797+00:00 app[Worker.1]: 在 processTicksAndRejections (internal/process/task_queues.js:95:5)2021-08-08T20:30:17.770798+00:00 app[Worker.1]: 在異步 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]: 在異步 Client.login (/app/node_modules/discord.js/src/client/Client.js:245:7)2021-08-08T20:30:17.770799+00:00 app[Worker.1]:(使用`node --trace-warnings ...`顯示警告的創建位置)2021-08-08T20:30:17.770962+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: 未處理的承諾拒絕.此錯誤源于在沒有 catch 塊的情況下拋出異步函數內部,或拒絕未使用 .catch() 處理的承諾.要在未處理的 Promise 拒絕時終止節點進程,請使用 CLI 標志 `--unhandled-rejections=strict`(請參閱 https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).(拒絕編號:2)2021-08-08T20:30:17.771045+00:00 app[Worker.1]: (node:4) [DEP0018] DeprecationWarning:未處理的承諾拒絕已被棄用.將來,未處理的 Promise 拒絕將使用非零退出代碼終止 Node.js 進程.

我不明白發生了什么,我認為唯一可能導致這種情況的變化是我創建了一個事件處理程序,我現在將事件放在他們自己的文件中,如命令,但我不確定是否這樣與此錯誤有關,我真的希望您能提供幫助.

解決方案

我最近也遇到了這個錯誤.

Discord.js 版本 13 在節點 16.6.1 上運行,但是默認 Heroku 節點版本是 14.x.p>

這意味著我們必須指定我們希望 Heroku 構建我們的應用程序的版本.

在 package.json 中添加

引擎":{節點":16.x",npm":7.x"}

參考:https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

這向 buildpack 指定我們需要使用最新版本的 node 16 和 npm 7.

但是,在我添加之后,我遇到了一個部署錯誤,并參考了這個 堆棧溢出問題

那里的答案是添加一個空的.npmignore";文件在你的根文件夾中,所以我這樣做了.但是,將所有內容推送到 Github 后,我仍然收到相同的部署錯誤.

這是說文件node.exe"在臨時目錄中丟失.經過反復試驗,我決定提交并推送node_modules/".到 Github 的目錄(這需要一些時間),因為(對不起,我沒有復制構建日志)文件node.exe"駐留在node_modules/"中目錄,然后重新部署我的應用程序,它工作了!

總而言之,這是一次往返之旅,因為我不知道.npmignore"是不是文件做任何事情(如果我錯了,請發表評論!).

回顧一下我為修復我的應用程序所做的工作:

  1. 將引擎說明符添加到 package.json
  2. 將 .npmignore 添加到根目錄(是否要添加,由您決定)
  3. 提交節點模塊文件夾并將其推送到 Github 頁面.
  4. 通過 Github 部署

僅供參考:我不知道這是否適用于 Heroku Git...如果有效,請在評論中告訴我.

So i have hosted my bot on heroku for some time now, and it worked just fine, but i recently moved, temporarly, to self hosting again cause i had to update to discord.js v13, but now i'm done with the changes, and i tried to re-host the bot on heroku, but it gives this error:

(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.

I don't understand what is happening, the only change that i think could cause this is the fact that i made an event handler and i now put events in their own files like commands, but i'm not sure if that has something to do with this error, i really hope you can help.

解決方案

I recently came across this error too.

Discord.js version 13 runs on node 16.6.1, however, the default Heroku node version is 14.x.

That means we have to specify the version that we want Heroku to build our app on.

In package.json add

"engines": {
   "node": "16.x",
   "npm": "7.x"
}

Reference: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

This specifies to the buildpack that we need to use the latest version of node 16 and npm 7.

However, after I added that, I came across a deployment error, and referred to this stack overflow question

The answer there stated to add an empty ".npmignore" file in your root folder, and so I did that. However, after pushing everything to Github, I still received the same deployment error.

It was saying that the file "node.exe" in a temp directory was missing. After some trial and error, I decided to commit and push the "node_modules/" directory to the Github (that took some time), because (sorry I didn't copy the build logs) the file "node.exe" resided in the "node_modules/" directory, and then re-deployed my application, and it worked!

All in all it was kind of a roundhouse trip, because I don't know if the ".npmignore" file does anything (please comment if I'm wrong!).

To recap what I did to fix my application:

  1. Add the engine specifiers to package.json
  2. Add .npmignore to the root directory (up to you if you want to add it)
  3. Commit and push the node modules folder to the Github page as well.
  4. Deploy through Github

FYI: I don't know if this works on Heroku Git... tell me in the comments if it works.

這篇關于Discord bot 不是從 heroku 開始的的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 一区二区三区四区在线 | 成人午夜精品一区二区三区 | 久草青青| 欧美精品在欧美一区二区 | 久久这里只有精品首页 | 天天操夜夜艹 | 国产日韩欧美一区二区在线播放 | 91传媒在线播放 | 久久亚洲一区 | 色站综合 | 久久大香 | 国产午夜在线 | 日韩和的一区二在线 | 国产精品福利视频 | 成人精品视频在线观看 | 天天摸天天看 | 视频一区在线观看 | 日韩欧美成人一区二区三区 | 久草热8精品视频在线观看 午夜伦4480yy私人影院 | 国产欧美日韩一区二区三区在线 | 97精品国产 | 久久精品国产亚洲a | 人人鲁人人莫人人爱精品 | 久久久久久精 | 精品九九 | 在线视频 亚洲 | 国产精品精品视频一区二区三区 | 久草视频在线播放 | 日韩精品一区二区三区在线观看 | 久久99精品久久久久子伦 | 亚洲成人精品国产 | 精品伊人久久 | 国产一区不卡 | 中文欧美日韩 | 久久久久国产精品免费免费搜索 | 在线观看视频你懂得 | 日韩国产精品一区二区三区 | 精品视频在线一区 | 免费一二区 | 午夜色婷婷| 免费一二区 |