Node.js app in Heroku Works on Foreman but not When Deployed?

科技动态 2018-06-24

I successfully have my app running on foreman start perfectly well, but as soon as I deploy it to Heroku, it throws me an error in the logs:

2012-08-20T03:22:48+00:00 heroku[web.1]: Starting process with command `node index.js`
2012-08-20T03:22:49+00:00 app[web.1]: Server has started.
2012-08-20T03:22:49+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 15134, should be 52717 (see environment variable PORT)
2012-08-20T03:22:49+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-08-20T03:22:51+00:00 heroku[web.1]: Process exited with status 137
2012-08-20T03:22:51+00:00 heroku[web.1]: State changed from starting to crashed

I have tried to change which port it binds to, but every time I do it changes the port again. Is there something else wrong in my app?

Problem courtesy of: Brad Ross

Node.js Recipes

责编内容by:Node.js Recipes (源链)。感谢您的支持!

您可能感兴趣的

Global variable for Jade templates in node.js I am using node.js with Jade templating system. Assum...
Nodejs的运行原理-调用篇 前言 之前做过Nodejs的 架构篇, 有很多朋友留言给我,说没看懂里面的例子,这里我会重新梳理一下,再以http server为例,来解析Nodej...
PHP’s SimpleXMLElement analog for Node.js The best XML reading and writing API I've ever used is PHP's Simpl...
Which Node.js Concurrent Web Server is best on Her... I have just learned about Heroku and was pretty much excited to test it out. Iv...
Node.js, multi-threading and Socket.io I'm looking to get Socket.io to work multi-threaded with native load balan...