How to bind port in Heroku With Node.js

Viewed 102

Heroku makes error like this

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}`);
})
1 Answers

To use environmental variables on Heroku you need to set them in the dashboard. Open https://dashboard.heroku.com/apps/YOUR_APP_NAME/settings, then click the REVEAL CONFIG VARS button. After that, you should get a possibility to set up environmental variables. Also, if you use the .env file you need to remove it.

Related