I am trying to deploy nodejs lite-server on Heroku. I am able to run the server fine locally, but fails on deployment with this error:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
The basic problem is I am not sure how to allow Heroku to set the port. They do this dynamically (I only know how to do it statically). So I need to set an environmental variable so the server can set the correct port. How can I do this using lite-server?
This problem has been address for different server setups:
To configure http server port for Heroku
Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)
To configure Express server port for Heroku
So I had the same issue. I ended up adding a bs-config.js file.
module.exports = {
port: process.env.PORT,
files: ['./**/*.{html,htm,css,js}'],
server:{
baseDir: "./"
}
};
Apparently Heroku dynamically assigns a new port each time it's started. So the port can't be hard coded.
How do I run Angular.JS 2 for TypeScript on C9.io on port 8080?