Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Node.js Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Tags:

I found a dozen solutions for Express powered apps with setting port to listen on. But I have an app that doesn't use Express and doesn't in fact listens anything. And after 60 seconds of it successfully running I get a Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch message. How I can get around it? Thanks.

like image 475
fivepointseven Avatar asked Jun 27 '15 19:06

fivepointseven


People also ask

Why does node js app crash with R10?

R10 - Boot timeout errors occur when a web process took longer than 60 seconds to bind to its assigned $PORT .

What is Procfile Heroku?

Heroku apps include a Procfile that specifies the commands that are executed by the app on startup. You can use a Procfile to declare a variety of process types, including: Your app's web server. Multiple types of worker processes. A singleton process, such as a clock.

Can not get node JS?

To fix the 'Error: Cannot GET /' error message with Node. js and Express, we need to add the route handler for the GET / route. app. get("/", (req, res) => { res.


1 Answers

After lots of googling I decided to npm install express and add

var express = require('express'); var app     = express();  app.set('port', (process.env.PORT || 5000));  //For avoidong Heroku $PORT error app.get('/', function(request, response) {     var result = 'App is running'     response.send(result); }).listen(app.get('port'), function() {     console.log('App is running, server is listening on port ', app.get('port')); }); 

This fixed the error, even though I don't like adding express just to avoid one error. If someone finds a better solution, please let me know.

like image 102
fivepointseven Avatar answered Sep 21 '22 18:09

fivepointseven