Heroku错误部署

Heroku error deployment

我正在尝试部署,但是这个错误不能让我离开。

2017-07-21T02:57:41.976265+00:00 app[web.1]: webpack: Compiled successfully.
2017-07-21T02:57:43.657908+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-07-21T02:57:43.658077+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-07-21T02:57:43.988993+00:00 heroku[web.1]: Process exited with status 137
2017-07-21T02:57:44.004007+00:00 heroku[web.1]: State changed from starting to crashed

这是我的服务器配置。

const PORT = process.env.PORT || 5000;
app.listen(PORT, 'localhost', err => {
  err && console.error(err);
  console.log(`Listening at 
  ${chalk.bold.cyan(`http://localhost:${PORT}/`)}`);
});

你不应该指定 localhost,否则节点只会监听本地接口,Heroku 进程管理器将无法看到你的进程实际上是 运行。

app.listen(PORT, err => {
  err && console.error(err);
  console.log(`Listening at 
  ${chalk.bold.cyan(`http://localhost:${PORT}/`)}`);
});