[英]Heroku Web process failed to bind to $PORT within 60 seconds of launch
i am making an application in angular, runs fine locally but when i try to deploy it with heroku, shows the next error: 我正在按角度制作应用程序,在本地运行良好,但是当我尝试使用heroku部署它时,显示下一个错误:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
the code looks like this: 代码如下:
const express= require('express'),
path= require('path');
const app =express();
app.use(express.static('./dist/re-mi'));
app.get('/*', (req,res)=>{
res.sendFile(path.join(__dirname, '/dist/myapp/index.html'));
});
var port_number = server.listen(process.env.PORT || 3000);
app.listen(port_number);
i also see other questions with the same error but no answer works for me 我也看到其他具有相同错误的问题,但没有答案适合我
It looks like the port_number
variable you have is not set correctly. 您所拥有的
port_number
变量似乎设置不正确。 If your full code is posted, then the variable server
is not defined anywhere. 如果完整代码已发布,则变量
server
未在任何地方定义。 That is from the line 那是从线
var port_number = server.listen(process.env.PORT || 3000);
Even if server
is defined, it seems unlikely that server.listen would return the port number that it is listening on. 即使定义了
server
,server.listen似乎也不太可能返回其正在侦听的端口号。 I think you would want: 我想你会想要:
var port_number = process.env.PORT || 3000;
app.listen(port_number);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.