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

前端 未结 24 1955
梦如初夏
梦如初夏 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:24

    I have the same issue but my environment variables are set well and the version of npm and node is specified in package.json. I figured out it is because, in my case, Heroku needs "start" to be specified in package.json:

      "scripts": {
        "start": "node index.js"
      }
    

    After adding this to my package.json my node app is successfully deployed on Heroku.

提交回复
热议问题