Heroku错误H14(没有运行Web进程)

Joh*_*Lee 28 heroku node.js npm

很确定有些人以前遇到过这个问题.

按照设置节点和npm的所有说明进行操作.推送到heroku时没有错误.但是,当我打开应用程序时,它显示"应用程序错误"

heroku ps
Run Code Online (Sandbox Code Playgroud)

回报

Process  State      Command       
-------  ---------  ------------  
main.1   up for 1m  node main.js
Run Code Online (Sandbox Code Playgroud)

heroku logs
Run Code Online (Sandbox Code Playgroud)

回报

Error H14 (No web processes running) -> GET mewtwo.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
Run Code Online (Sandbox Code Playgroud)

我尝试重新启动应用程序,heroku restart但仍然得到相同的错误.谷歌周围没有其他解决方案heroku restart.有人试过其他方法吗?


答:(我把它放在这里因为我的代表太低而无法发布答案)

好吧终于弄清楚了自己.

我宣称,显然在Procfile中

main: node main.js
Run Code Online (Sandbox Code Playgroud)

但Heroku使用

web: node main.js
Run Code Online (Sandbox Code Playgroud)

我认为命名可以是你想要的任何东西,但它实际上是严格的,你需要使用网络才能工作(heroku没有强调这一点 - 要小心)至少现在,直到我弄清楚为什么这么严格,如果我能改名称.

Jef*_*key 74

我有同样的问题,但对我来说这是因为我需要跑 heroku ps:scale web=1

  • 如果您最初忘记推送`Procfile`,则需要这样做.在这种情况下,即使稍后推送或运行`heroku ps:restart`也无济于事. (14认同)
  • 添加Procfile后我没有看到任何内容.但是然后设置ps:scale web = 1立即启动并运行.谢谢! (3认同)

Nei*_*ton 14

您的Web进程的名称必须是web,这是Heroku在初始部署时始终扩展为"1"的过程.

Procfile中的其他服务可以根据需要调用,但是您需要最初调整它们(因此,如果需要,您可以在其中只使用dev).

更多信息请访问:http://neilmiddleton.com/the-procfile-is-your-friend/ (缓存版本:https://web.archive.org/web/20130926005616/http : //www.neilmiddleton.com/the-procfile-is-your-friend)