【问题标题】:Why isn't my Heroku discord bot going online?为什么我的 Heroku discord bot 没有上线?
【发布时间】:2020-04-28 13:53:56
【问题描述】:

我正在使用 discord.js 编写一个不和谐机器人,并尝试使用 Heroku 来托管该机器人。 当我部署它时,Heroku 说部署成功,但我的机器人仍然处于不和谐的离线状态。当我检查日志时,它显示:


2020-01-10T21:55:49.598875+00:00 app[worker.1]: npm ERR! code ELIFECYCLE

2020-01-10T21:55:49.599295+00:00 app[worker.1]: npm ERR! errno 1

2020-01-10T21:55:49.600878+00:00 app[worker.1]: npm ERR! funamibot@1.0.0 start: `node index.js`

2020-01-10T21:55:49.601091+00:00 app[worker.1]: npm ERR! Exit status 1

2020-01-10T21:55:49.601329+00:00 app[worker.1]: npm ERR! 

2020-01-10T21:55:49.601552+00:00 app[worker.1]: npm ERR! Failed at the funamibot@1.0.0 start script.

2020-01-10T21:55:49.601651+00:00 app[worker.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2020-01-10T21:55:49.607761+00:00 app[worker.1]: 

2020-01-10T21:55:49.607944+00:00 app[worker.1]: npm ERR! A complete log of this run can be found in:

2020-01-10T21:55:49.608089+00:00 app[worker.1]: npm ERR!     /app/.npm/_logs/2020-01-10T21_55_49_602Z-debug.log

从它给出的错误来看,它似乎与 package.json 文件中的启动脚本有关,但我不确定问题是什么或如何解决它。

github上的bot代码:https://github.com/Yunoxa/funamibot/

【问题讨论】:

  • 日志上面有移动信息吗?
  • @PLASMAchicken 不,这就是日志中显示的所有内容。

标签: heroku npm discord.js


【解决方案1】:

您必须包含用于 nodenpm 的版本(我建议使用最新的):

"engines": {
  "node": "12.14.1",
  "npm": "6.13.4"
},

但是,如果您使用的是 node 或 npm 的特定版本,请执行此操作并替换我指定的版本号:

node -v (Returns the current version of Node you're running.)

npm -v (Returns the current version of NPM you're running.)

【讨论】:

  • 我添加了这个,但我仍然在日志中收到同样的错误。
猜你喜欢
  • 2021-11-18
  • 2021-11-11
  • 2020-08-15
  • 2021-03-13
  • 2020-12-21
  • 2020-11-25
  • 1970-01-01
  • 2021-05-13
  • 2021-07-17
相关资源
最近更新 更多