简体   繁体   English

Heroku worker dyno 即使添加到 Procfile 中也没有显示

[英]Heroku worker dyno not showing up even though it is added in Procfile

I am trying to set up Heroku to host my Discord bot.我正在尝试设置 Heroku 来托管我的 Discord 机器人。 I am sure that I have set up my Procfile correctly, but the worker dyno doesn't show up under Resources.我确信我已经正确设置了我的 Procfile,但是 worker dyno 没有出现在 Resources 下。 Only the web dyno shows up and that doesn't work as it crashes with error R10 immediately after startup.只有 web dyno 出现并且不起作用,因为它在启动后立即崩溃并出现错误 R10。 Can someone help?有人可以帮忙吗?

Procfile简介

worker: node index.js

package.json package.json

{
  "name": "bot name",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "author": "author",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^12.2.0"
  }
}

Log日志

2020-07-28T17:03:18.000000+00:00 app[api]: Build started by user 
2020-07-28T17:03:42.000000+00:00 app[api]: Build succeeded
2020-07-28T16:58:24.618732+00:00 app[api]: Release v20 created by user
2020-07-28T16:58:24.897854+00:00 heroku[web.1]: State changed from crashed to starting
2020-07-28T16:58:27.754015+00:00 heroku[web.1]: Starting process with command `npm start`
2020-07-28T16:58:31.218171+00:00 app[web.1]: 
2020-07-28T16:58:31.218205+00:00 app[web.1]: > bot@0.9.0 start /app
2020-07-28T16:58:31.218206+00:00 app[web.1]: > node index.js
2020-07-28T16:58:31.218206+00:00 app[web.1]: 
2020-07-28T16:58:32.169174+00:00 app[web.1]: LOG> bot is now online!
2020-07-28T16:58:35.000000+00:00 app[api]: Build started by user 
2020-07-28T16:58:58.755714+00:00 heroku[web.1]: State changed from starting to down
2020-07-28T16:58:58.660155+00:00 app[api]: Deploy 643b70ba by user 
2020-07-28T16:58:58.660155+00:00 app[api]: Release v21 created by user 
2020-07-28T16:58:59.000000+00:00 app[api]: Build succeeded
2020-07-28T16:59:28.079035+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-07-28T16:59:28.102556+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-07-28T16:59:28.220163+00:00 heroku[web.1]: Process exited with status 137

资源选项卡下的 Dyno 列表

I deleted everything and set everything up again and it seems to work now.我删除了所有内容并重新设置了所有内容,现在它似乎可以工作了。 It's possible that it wasn't working because I didn't have the node_modules folder or because of some other error that happened in the first attempt of setting the bot up.它可能无法正常工作,因为我没有 node_modules 文件夹,或者因为在第一次尝试设置机器人时发生了一些其他错误。

  1. Go to your heroku app Go 到您的 heroku 应用程序
  2. Select Resources menu Select 资源菜单
  3. Turn on the "worker: node index.js" and turn off the "web npm start"打开“worker:node index.js”,关闭“web npm start”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM