Heroku Node.js错误R10(引导超时) - > Web进程无法在启动后的60秒内绑定到$ PORT [英] Heroku Node.js Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
问题描述
我找到了十几个解决快速供电应用程序的设置端口来侦听。
但是我有一个不使用Express的应用程序,实际上并没有监听任何东西。
在成功运行60秒后,我得到一个错误R10(引导超时) - >在启动后的60秒内,Web进程无法绑定到$ PORT消息
消息。
我如何解决它?感谢。
经过大量的谷歌搜索,我决定 npm install express
并添加
var express = require('express');
var app = express();
app.set('port',(process.env.PORT || 5000));
//为避免Heroku $ PORT错误
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'));
});
这样可以解决错误,尽管我不喜欢为了避免一个错误而添加express。如果有人找到更好的解决方案,请告诉我。
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.
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.
这篇关于Heroku Node.js错误R10(引导超时) - > Web进程无法在启动后的60秒内绑定到$ PORT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!