问题
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