The code shown below fails on Heroku with the error Stopping process with SIGKILL
http.createServer((req, res) => {
var server_port = process.env.YOUR_PORT || process.env.PORT || 80;
var server_host = process.env.YOUR_HOST || '0.0.0.0';
server.listen(server_port, server_host, function() {
console.log('Listening on port %d', server_port);
});
});
Logs:
heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
How can I fix this issue?
You have not declared the variable server
.
You can do:
var server = http.createServer((req, res) => {
//your stuff
});
server.listen(process.env.PORT || 80, () => {
console.log("Listening on port 80");
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.