[英]How to bind port in Heroku With Node.js
Heroku makes error like this Heroku 出现这样的错误
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60
seconds of launch
I think port isn't make trouble But many documents say timeout is port trouble我认为端口不是问题但是很多文件说超时是端口问题
My code我的代码
const port = process.env.port || 8080;
app.listen(port, () => {
console.log(process.env.port);
console.log(`SERVER is running at ${port}`);
})
To use environmental variables on Heroku you need to set them in the dashboard.要在 Heroku 上使用环境变量,您需要在仪表板中设置它们。 Open https://dashboard.heroku.com/apps/YOUR_APP_NAME/settings , then click the
REVEAL CONFIG VARS
button.打开https://dashboard.heroku.com/apps/YOUR_APP_NAME/settings ,然后单击
REVEAL CONFIG VARS
按钮。 After that, you should get a possibility to set up environmental variables.之后,您应该可以设置环境变量。 Also, if you use the
.env
file you need to remove it.此外,如果您使用
.env
文件,则需要将其删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.