Heroku中的Node.js应用程序在Foreman上工作但在部署时没有?

Bra*_*oss 2 git heroku node.js foreman

我成功地让我的应用程序在foreman上运行得很好,但是一旦我将它部署到Heroku,就会在日志中抛出错误:

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
Run Code Online (Sandbox Code Playgroud)

我试图更改它绑定的端口,但每次我更改端口.我的应用程序中还有其他错误吗?

Rot*_*rel 6

在Heroku上,您需要使用环境变量中包含的端口:process.env.PORT