Search code examples
herokudeploymentwebpackbundle

Heroku error deployment


I am trying to deploy, but this error can't let me go.

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

This is my server config.

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}/`)}`);
});

Solution

  • You shouldn't specify localhost, or node will only listen on the local interface, and the Heroku process manager won't be able to see that your process is actually running.

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