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.
23
votes
5 Answers
39
votes
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.
33
votes
24
votes
0
votes
0
votes
I also got the same the same problem:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
flowing work in my pc windows 10 visual studio code
app.listen(process.env.PORT || 8080);
also added these three line in package.json
"worker": "node index.js",
"start": "node index.js"
"test": "node test.js"