Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

前端 未结 24 2276
梦如初夏
梦如初夏 2020-11-22 05:42

I have my first node.js app (runs fine locally) - but I am unable to deploy it via heroku (first time w/ heroku as well). The code is below. SO doesn\'t let me write so much

24条回答
  •  余生分开走
    2020-11-22 06:11

    Edit package.json:

    ...
    "engines": {
    "node": "5.0.0",
    "npm": "4.6.1"
    },
    ...
    

    and Server.js:

    ...
    var port = process.env.PORT || 3000;
    app.listen(port, "0.0.0.0", function() {
    console.log("Listening on Port 3000");
    });
    ...
    

提交回复
热议问题