简体   繁体   English

Heroku Web进程在启动后60秒内未能绑定到$ PORT

[英]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.

相关问题 Heroku || 错误 R10(启动超时)-> Web 进程未能在启动后 60 秒内绑定到 $PORT - Heroku || Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch Node.js将错误上传到Heroku,Web进程在启动后60秒内未能绑定到$ PORT - Node.js upload error to Heroku, Web process failed to bind to $PORT within 60 seconds of launch heroku 和 nodejs 错误(Web 进程未能在启动后 60 秒内绑定到 $PORT) - heroku and nodejs erorr (Web process failed to bind to $PORT within 60 seconds of launch) 错误 R10(启动超时)-> Web 进程未能在启动后 60 秒内绑定到 $PORT - HEROKU 错误 - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch - HEROKU ERROR 尝试将我的 node.js 应用程序上传到 heroku,它说 Web 进程无法在启动后 60 秒内绑定到 $PORT,进程退出,状态为 137 - tried to upload my node.js app to heroku,it says Web process failed to bind to $PORT within 60 seconds of launch, Process exited with status 137 Web进程无法绑定$ port节点 - Web process failed to bind $port node Heroku无法将端口号注入到process.env.PORT - Heroku failed to inject port number to process.env.PORT 尝试将Python /烧瓶应用程序部署到Heroku时无法绑定到$ PORT - Failed to bind to $PORT when trying to deploy Python/flask app to Heroku 每60秒仅启动一次事件(JavaScript) - Launch Event Only Once Every 60 Seconds (JavaScript) 启动浏览器进程失败! Ubuntu - Failed to launch the browser process! Ubuntu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM