Express Hello World - Heroku Foreman返回Code 5,'npm start'工作得很好

时间:2022-10-07 17:43:24

I'm following a tutorial in which I created a simple "Hello World" in Express. The tutorial gets everything up and running locally just fine with 'npm start'. The tutorial then moves on to prepare for uploading code to Heroku via Toolbelt. Following the directions (so far as I can tell), I execute 'foreman start'. When I hit the localhost URI, I get the basic HTML I'm expecting, but no CSS (no doubt related to the ERR_CONNECTION_REFUSED outputs I see in the console window, which is probably related to the whole server being shut down). Looking at the output from the command line, there is the text:

我正在按照一个教程,我在Express中创建了一个简单的“Hello World”。该教程通过'npm start'将所有内容完成并在本地运行。然后,本教程继续准备通过Toolbelt将代码上传到Heroku。遵循指示(据我所知),我执行'foreman start'。当我点击localhost URI时,我得到了我期望的基本HTML,但没有CSS(毫无疑问与我在控制台窗口中看到的ERR_CONNECTION_REFUSED输出有关,这可能与整个服务器关闭有关)。查看命令行的输出,有文本:

exited with code 5
sending SIGKILL to all processes

I've searched Google for what Foreman's code 5 is, but didn't see anywhere that discussed code 5. I downloaded the source code for Foreman on https://github.com/ddollar/foreman, but still couldn't figure out what code 5 is (!?!?). I suspect I could work out the issue if I knew what code 5 meant. Anyone out there know what it is?

我在谷歌搜索了Foreman的代码5是什么,但没有看到任何讨论过代码的地方5.我在https://github.com/ddollar/foreman上下载了Foreman的源代码,但仍然无法弄清楚代码5是什么(!?!?)。如果我知道代码5意味着什么,我怀疑我可以解决这个问题。那里的任何人都知道它是什么?

1 个解决方案

#1


I faced exactly your problem, including exactly those foreman messages, and the ERR_CONNECTION_REFUSED messages after the server stopped.

我确切地面对了你的问题,包括那些工头消息,以及服务器停止后的ERR_CONNECTION_REFUSED消息。

In the past I had regressed to version 0.61.0 of foreman as a workaround (on Windows 7), but 0.61.0 is incompatible with Express 4, so that was no longer viable for me.

在过去,我已经退回到工头版本0.61.0作为解决方法(在Windows 7上),但是0.61.0与Express 4不兼容,所以这对我来说不再可行。

I never found a solution for the "code 5" error, but happily a better approach is now available:

我从来没有找到“代码5”错误的解决方案,但很高兴现在可以使用更好的方法:

  • Download and install the latest version of heroku toolbelt.

    下载并安装最新版本的heroku toolbelt。

  • Instead of instead of using foreman (which heroku no longer supports), start your application using the new command "heroku local".

    而不是使用foreman(heroku不再支持),而是使用新命令“heroku local”启动应用程序。

This worked for me on Windows 7. I posted more details on SO here.

这在Windows 7上对我有用。我在这里发布了更多有关SO的详细信息。

#1


I faced exactly your problem, including exactly those foreman messages, and the ERR_CONNECTION_REFUSED messages after the server stopped.

我确切地面对了你的问题,包括那些工头消息,以及服务器停止后的ERR_CONNECTION_REFUSED消息。

In the past I had regressed to version 0.61.0 of foreman as a workaround (on Windows 7), but 0.61.0 is incompatible with Express 4, so that was no longer viable for me.

在过去,我已经退回到工头版本0.61.0作为解决方法(在Windows 7上),但是0.61.0与Express 4不兼容,所以这对我来说不再可行。

I never found a solution for the "code 5" error, but happily a better approach is now available:

我从来没有找到“代码5”错误的解决方案,但很高兴现在可以使用更好的方法:

  • Download and install the latest version of heroku toolbelt.

    下载并安装最新版本的heroku toolbelt。

  • Instead of instead of using foreman (which heroku no longer supports), start your application using the new command "heroku local".

    而不是使用foreman(heroku不再支持),而是使用新命令“heroku local”启动应用程序。

This worked for me on Windows 7. I posted more details on SO here.

这在Windows 7上对我有用。我在这里发布了更多有关SO的详细信息。