Express Hello World — Heroku Foreman Returns Code 5, 'npm start' works just fine

不羁岁月 提交于 2020-01-06 19:25:51

问题


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:

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?


回答1:


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

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.

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

  • Download and install the latest version of heroku toolbelt.

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

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



来源:https://stackoverflow.com/questions/30064959/express-hello-world-heroku-foreman-returns-code-5-npm-start-works-just-fin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!