Why do I obtain this error when deploying app to Heroku?

前端 未结 4 978
死守一世寂寞
死守一世寂寞 2020-12-02 17:40

I am getting some kind of error when deploying my app to heroku using git hub. The problem is, I don\'t understand the heroku logs and the entailing errors. Here is the hero

相关标签:
4条回答
  • 2020-12-02 18:10

    I also faced similar kind of errors for my node js app while publishing it to heroku.com

    First create a procfile, procfile is a simple text file but without any extension.

    Place only one line in procfile as of now.

    web: npm start
    

    Now create the package.json file using command

    npm init
    

    once your package.json file got created please place the start property inside scripts.

    "scripts": {
        "start": "node app.js",
        "test": "echo \"Error: no test specified\" && exit 1"
      },
    

    now commit all (procfile/package.json) pending files. and deploy app again from heroku.

    0 讨论(0)
  • 2020-12-02 18:21

    My silly mistake was that I was pushing the master branch to Heroku while my changes were in another branch!

    Make sure that you merge your latest branch with your master branch first

    > git checkout master
    
    > git merge your-latest-branch
    
    > git push heroku master
    
    0 讨论(0)
  • 2020-12-02 18:26

    You have to inform heroku where to start : missing script: start. In your package.json, you should have something like this:

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

    Where index.js is your entry point.

    As an alternative, you can specify in Procfile:

    web: node index.js
    
    0 讨论(0)
  • 2020-12-02 18:30

    In my case, changing this:

    "scripts": {
         "test": "echo \"Error: no test specified\" && exit 1"
        },
    

    to this:

    "scripts": {
       "start": "node app.js"
        },
    

    was the solution

    0 讨论(0)
提交回复
热议问题