使用 Heroku 部署时出现 Discord 应用程序错误 R10 [英] Discord app error R10 when deploying with Heroku

查看:28
本文介绍了使用 Heroku 部署时出现 Discord 应用程序错误 R10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将使用 Node.js 制作的 Discord 机器人部署到 Heroku,构建成功但应用程序崩溃并引发错误:

I tried to deploy my discord bot made with Node.js to Heroku, the build is successful but the app crashes and throws an error:

Error R10 (Boot timeout)
Web process failed to bind to $PORT within 60 seconds of launch

我的Procfile:

web: node app.js

package.json:

{
  "name": "bot",
  "version": "5.0",
  "description": "Discord Bot",
  "main": "app.js",
  "scripts": {
    "start": "node app.js"
  },
  "author": "me",
  "license": "MIT",
  "dependencies": {
    "discord.js": "^11.3.2",
    "ffmpeg-binaries": "^3.2.2-3",
  }
}

我的应用程序需要几秒钟才能在本地启动.

My app takes a few seconds to launch localy.

我该如何解决这个问题?

How can I fix this?

推荐答案

这是因为您不是在构建网站,而是将 dyno 设置为 web.
您可以通过将 web 替换为 worker 来更改 Procfile 中的 dyno 类型:

That's caused by the fact that you're not building a website, but your dyno is set to web.
You can change your dyno type in your Procfile by replacing web with worker:

worker: node app.js

转到您的 Heroku 应用仪表板

Make sure this new worker dyno is active by going to your Heroku app dashboard > your app > resources (you can use the pencil buttons to turn on/off dynos)

这篇关于使用 Heroku 部署时出现 Discord 应用程序错误 R10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆