【问题标题】:(heroku) Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch(heroku) 错误 R10 (启动超时) -> Web 进程未能在启动后 60 秒内绑定到 $PORT
【发布时间】:2021-04-05 05:32:04
【问题描述】:

我是一名初学者 Discord 机器人开发人员,他希望 24/7 全天候在 Heroku 上托管他的 heroku 机器人。 大约后。部署 1 分钟,出现错误:

2020-12-28T11:40:54.000493+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-12-28T11:40:54.024808+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-12-28T11:40:54.088413+00:00 heroku[web.1]: Process exited with status 137
2020-12-28T11:40:54.121927+00:00 heroku[web.1]: State changed from starting to crashed

package.json 中的代码:

{
  "name": "mano-county-bot",
  "version": "1.0.0",
  "description": "Bot for Mano County!",
  "main": "index.js",
  "dependencies": {
    "bloxlink": "^1.6.0",
    "chalk": "^4.1.0",
    "discord.js": "^12.5.1",
    "figlet": "^1.5.0",
    "noblox.js": "^4.7.3",
    "roblox-js": "^4.0.4",
    "trello-node-api": "0.0.9"
  },
  "devDependencies": {},
  "scripts": {
    "start": "node index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Alex_Google214",
  "license": "ISC"
}

是的,我没有使用快递。

我有一段带有引擎的代码

  "engines": {
    "node": "14.x",
    "npm": "6.x"
  },

在删除项目未部署之前。但是在删除之后,它部署了,然后我得到了我愿意得到帮助的错误。提前致谢!

【问题讨论】:

  • 您的应用是否应该监听 HTTP / HTTPS 请求?
  • 不知道,我不确定,但我想没有。 (但我实际上认为是的,因为一个回答(Beppe C)的人说我应该在我的 Procfile 中定义 web 进程?

标签: node.js heroku discord.js


【解决方案1】:

Dynos

问题就在这里。我启用了 web dyno 并禁用了 Worker。但后来我禁用了 web dyno 并打开了 Worker 并且它工作了!

【讨论】:

    【解决方案2】:

    您必须在 Procfile 中定义了一个 Web 进程:该 Web 进程将尝试绑定一个可以通过 HTTPS 访问的端口。如果不发生这种情况,则部署失败。

    Discord 机器人通常在后端工作(无 HTTP 访问):更改您的 Procfile 以使用工作人员。

    【讨论】:

    • 这是我的 Procfile,有什么要编辑的吗? ``` Worker:节点 index.js app.listen(process.env.PORT || 5000) ```
    • 我看到 app.listen 有问题,所以我删除了它。
    猜你喜欢
    • 2021-08-19
    • 2019-07-04
    • 1970-01-01
    • 2016-03-08
    • 1970-01-01
    • 2020-12-09
    • 2019-04-20
    • 2015-09-14
    • 2021-07-26
    相关资源
    最近更新 更多