Categories
JavaScript Answers

How to fix Heroku Node.js app deploy failed `error code=H10`?

Spread the love

To fix Heroku Node.js app deploy failed error code=H10, we should not hard code the port for our app.

For instance, we write

app.listen(process.env.PORT || 3000, () => {});

to call listen with the PORT environment variable or 3000 as a fallback to run with the port from the environment variable or on port 3000 as the default.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *