Carlos Ottoboni
Carlos Ottoboni

Reputation: 23

Error while deploying NodeJs app on Heroku

I've tried to deploy my NodeJs app on Heroku, follows all steps on Heroku guide but I can't make it running. Here is the log:

2016-06-27T18:46:16.424477+00:00 heroku[web.1]: State changed from crashed to starting
    2016-06-27T18:46:18.594534+00:00 heroku[web.1]: Starting process with command `npm start`
    2016-06-27T18:46:21.204182+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
    2016-06-27T18:46:21.205909+00:00 app[web.1]: npm ERR! npm  v3.8.6
    2016-06-27T18:46:21.204971+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
    2016-06-27T18:46:21.209309+00:00 app[web.1]: npm ERR! missing script: start
    2016-06-27T18:46:21.221679+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
    2016-06-27T18:46:21.209934+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
    2016-06-27T18:46:21.207755+00:00 app[web.1]: 
    2016-06-27T18:46:21.221362+00:00 app[web.1]: 
    2016-06-27T18:46:21.209552+00:00 app[web.1]: npm ERR! 
    2016-06-27T18:46:21.209740+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
    2016-06-27T18:46:21.221872+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
    2016-06-27T18:46:21.205374+00:00 app[web.1]: npm ERR! node v5.11.1
    2016-06-27T18:46:22.240678+00:00 heroku[web.1]: Process exited with status 1
    2016-06-27T18:46:22.255389+00:00 heroku[web.1]: State changed from starting to crashed

Any thoughts?

[EDIT]

package.json:

"engines": {
  "node": "5.11.1",
  "npm": "3.8.6"
  },
  "scripts": {
    "start": "node app.js"
  },

Procfile:

web: npm start

Upvotes: 0

Views: 120

Answers (2)

Hamzeen Hameem
Hamzeen Hameem

Reputation: 2560

package.json

{
  "name": "your-project-name",
  "version": "1.0.0",
  "description": "desc",
  "main": "app.js",
  "scripts": {
    "start": "node app.js",
    ...
  }
  ...
}

Procfile

Above package.json is file good to go without a Procfile. Yet, if you want to have one, you can define it as follows:

web: node app.js

Upvotes: 1

hunterloftis
hunterloftis

Reputation: 13809

You need to tell Heroku how to start your app. Either do that by specifying a "start" script in package.json, or by providing a Procfile.

Upvotes: 1

Related Questions