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阅读原文】。感谢您的支持!

您可能感兴趣的

node: Build a Node.js REST API with LoopBack In this course the developer will learn how to create a LoopBack API and build it out to an API that can be used as a ba...
How does next() work in Node.js? I recently read a blog in Nodejitsu and I am wondering how this piece of code works. var fs = require('fs'...
Graceful shutdown and Kubernetes readiness / liven... terminus Adds graceful shutdown and Kubernetes readiness / liveness checks for any HTTP applications. Usage const ...
Ask HN: How to avoid getting sucked in too deep by... Try TypeScript or ReasonML or ScalaJS. They all compile to JS and have dead-easy FFI so you can still use the ecosystem ...
Include class definition file How can I include a file, which contains classes definitions in my server.js file? I don't want to use module....