3

Heroku web is throwing error :npm ERR! missing script: start

However, when I run it locally: heroku local web it works fine. Project is successfully build.

I have set start script in my package.json as:

"scripts": {
    "start": "node server"
  }

as per the document, If I don't specify the Procfile, by default it should take npm start

However, I also tried adding the Procfile:

Procfile content.

web: npm start

It throws the same error.

log output: heroku logs -a nypstest

Niteshs-MacBook-Pro:nyps nitesh$ heroku logs -a nypstest
2016-06-15T07:01:44.024250+00:00 heroku[api]: Release v3 created by [email protected]
2016-06-15T07:01:44.023668+00:00 heroku[api]: Scale to web=1 by [email protected]
2016-06-15T07:01:44.429595+00:00 heroku[slug-compiler]: Slug compilation started
2016-06-15T07:01:44.429603+00:00 heroku[slug-compiler]: Slug compilation finished
2016-06-15T07:01:46.222149+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T07:01:49.138230+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T07:01:49.141111+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-06-15T07:01:49.139367+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T07:01:49.139986+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T07:01:49.160916+00:00 app[web.1]: 
2016-06-15T07:01:49.145755+00:00 app[web.1]: npm ERR! 
2016-06-15T07:01:49.146073+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T07:01:49.143580+00:00 app[web.1]: 
2016-06-15T07:01:49.146389+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2016-06-15T07:01:49.161685+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-06-15T07:01:49.161369+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T07:01:49.145444+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T07:01:50.132213+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T07:01:50.152654+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T07:01:50.151676+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T07:01:52.430686+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T07:01:55.754745+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T07:01:55.753213+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T07:01:55.759649+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T07:01:55.754205+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T07:01:55.755673+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-06-15T07:01:55.759409+00:00 app[web.1]: npm ERR! 
2016-06-15T07:01:55.759143+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T07:01:55.757612+00:00 app[web.1]: 
2016-06-15T07:01:55.759874+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2016-06-15T07:01:55.772868+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-06-15T07:01:55.772730+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T07:01:55.772370+00:00 app[web.1]: 
2016-06-15T07:01:56.675716+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T07:01:56.687035+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T07:03:23.527948+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=b064f04d-b6b8-4655-adc4-c4bbdb4db70a fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:03:26.783968+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=dfa98acd-5291-46df-85e6-ec2d7bd1afa0 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:25:30.940961+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T07:25:33.374221+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T07:25:35.711736+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T07:25:35.712514+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T07:25:35.712824+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T07:25:35.713260+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-06-15T07:25:35.714628+00:00 app[web.1]: 
2016-06-15T07:25:35.716136+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T07:25:35.716418+00:00 app[web.1]: npm ERR! 
2016-06-15T07:25:35.716638+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T07:25:35.716866+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2016-06-15T07:25:35.726294+00:00 app[web.1]: 
2016-06-15T07:25:35.726558+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T07:25:35.726717+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-06-15T07:25:36.541486+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T07:25:36.529432+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T07:25:55.677715+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=d67c3c7f-1b0c-4ae4-8066-f539c676c813 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:25:56.970694+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=a5e959df-5c6b-475e-883d-668fffc3b1ca fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:37:15.873210+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=83d3f406-22ba-4649-81c4-261889c6f26d fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:37:17.263994+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=b24ecc40-99ed-4ee4-8975-850f02880751 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:31.730476+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=46c7351c-6818-466c-b816-fab8686a3a26 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:32.902969+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=a29d2281-9931-412d-befb-4788284e6dc3 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:46.425659+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=69f32408-7b94-41ed-a692-3874bb87125e fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:40:47.283575+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=82645270-a085-49f0-8bdd-8ffbd417e136 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:46:45.562741+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=d6b356f1-e7f3-4e74-a9bc-7834b6ddaa39 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T07:46:46.792388+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=0df4dfd9-5368-41b3-a658-37c80effc3c5 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:09:20.166494+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T08:09:22.215228+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T08:09:25.009624+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T08:09:25.010335+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T08:09:25.010667+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T08:09:25.011377+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-06-15T08:09:25.013096+00:00 app[web.1]: 
2016-06-15T08:09:25.014247+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T08:09:25.014442+00:00 app[web.1]: npm ERR! 
2016-06-15T08:09:25.014622+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T08:09:25.014765+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2016-06-15T08:09:25.025073+00:00 app[web.1]: 
2016-06-15T08:09:25.025367+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T08:09:25.025542+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-06-15T08:09:25.854231+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T08:09:25.844519+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T08:26:54.120685+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=8e5dbaff-ba8a-4a2f-a4f5-b56e6aba2871 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:26:55.251426+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=ada7aaf7-a2c6-4f98-b387-3f201102b09c fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:36:41.113185+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=e412adc8-0d6f-45c9-b30d-06774366132e fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T08:36:42.534191+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=bcc98a01-93d2-40b8-91ce-d59f67f54c7a fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T09:32:52.373988+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-15T09:32:54.422584+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-15T09:32:57.749315+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-15T09:32:57.751518+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-06-15T09:32:57.753827+00:00 app[web.1]: 
2016-06-15T09:32:57.755515+00:00 app[web.1]: npm ERR! 
2016-06-15T09:32:57.750410+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-15T09:32:57.750924+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-15T09:32:57.755280+00:00 app[web.1]: npm ERR! missing script: start
2016-06-15T09:32:57.773805+00:00 app[web.1]: 
2016-06-15T09:32:57.755821+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2016-06-15T09:32:57.755662+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-15T09:32:57.774094+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-15T09:32:57.774273+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-06-15T09:32:58.841956+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-15T09:32:58.826851+00:00 heroku[web.1]: Process exited with status 1
2016-06-15T09:49:37.707537+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nypstest.herokuapp.com request_id=bc832c95-120e-4b59-ad83-7dd95f7081f8 fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
2016-06-15T09:49:39.156404+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nypstest.herokuapp.com request_id=0f6b252e-8e67-47b1-9c21-c41eea09e0ef fwd="106.51.141.204" dyno= connect= service= status=503 bytes=
Niteshs-MacBook-Pro:nyps nitesh$ 

Package.json

  ...app descriptions

  "main": "index.js",
  "scripts": {
    "start": "node server"
  },

  ...other dependencies

server.js

var webpack = require('webpack')
var webpackDevMiddleware = require('webpack-dev-middleware')
var webpackHotMiddleware = require('webpack-hot-middleware')
var config = require('./webpack.config')
var serveStatic = require('serve-static');
var sendMail = require('./src/api/sendmail');
var bodyParser = require('body-parser');
var app = new (require('express'))()

var port = process.env.WEBPACK_PORT || 3000

var compiler = webpack(config)
app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath }))
app.use(webpackHotMiddleware(compiler))

// parse application/json
app.use(bodyParser.json());

    // parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }));


app.get('*', function(req, res) {
  res.sendFile(__dirname + '/index.html')
})




app.listen(port, function(error) {
  if (error) {
    console.error(error)
  } else {
    console.info("==> 🌎  Listening on port %s. Open up http://localhost:%s/ in your browser.", port, port)
  }
})

Edit: Complete Package.json

{
  "name": "App_Name",
  "version": "1.0.0",
  "description": "Some-Discription",
  "keywords": [
    "redux",
    "react",
    "router",
    "routing",
    "frontend",
    "client",
    "webpack",
    "babel",
    "sass",
    "foundation",
    "postcss"
  ],
  "main": "index.js",
  "scripts": {
    "start": "node server.js",
    "test": "mocha",
    "postinstall": "bower install && grunt build"
  },
  "author": "Nitesh",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.11.1",
    "body-parser": "^1.15.1",
    "classnames": "^2.2.0",
    "connect": "^3.4.1",
    "firebase": "^3.0.3",
    "firebase-token-generator": "^2.0.0",
    "font-awesome": "^4.3.0",
    "foundation-sites": "^6.1.2",
    "json-loader": "^0.5.4",
    "mongodb": "^2.1.20",
    "mongoose": "^4.4.19",
    "react": "^0.14.5",
    "react-addons-update": "^0.14.7",
    "react-autosuggest": "^3.7.4",
    "react-dom": "^0.14.7",
    "react-modal": "^1.3.0",
    "react-router": "2.0.0-rc5",
    "react-router-redux": "^2.1.0",
    "react-simple-autocomplete": "^1.0.2",
    "redux": "^3.2.1",
    "redux-form": "^5.2.5",
    "redux-logger": "^2.5.2",
    "redux-thunk": "^1.0.3",
    "request": "^2.65.0",
    "rethinkdb": "^2.3.1",
    "sendgrid": "^2.0.0",
    "underscore": "^1.8.3",
    "what-input": "^1.1.4"
  },
  "optionalDependencies": {},
  "devDependencies": {
    "autoprefixer": "^6.3.2",
    "babel-core": "^6.3.15",
    "babel-loader": "^6.2.0",
    "babel-plugin-transform-runtime": "^6.5.0",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "babel-preset-react-hmre": "^1.0.1",
    "babel-preset-stage-0": "^6.5.0",
    "babel-runtime": "^6.9.0",
    "css-loader": "^0.23.1",
    "express": "^4.13.3",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.5",
    "jquery": "^2.2.4",
    "node-sass": "^3.4.2",
    "postcss-loader": "^0.8.0",
    "react-redux": "^4.4.5",
    "redux-devtools": "^3.1.0",
    "redux-devtools-dock-monitor": "^1.0.1",
    "redux-devtools-log-monitor": "^1.0.3",
    "sass-loader": "^3.1.2",
    "script-loader": "^0.6.1",
    "serve-static": "^1.10.2",
    "style-loader": "^0.13.0",
    "url-loader": "^0.5.7",
    "webpack": "^1.9.11",
    "webpack-dev-middleware": "^1.2.0",
    "webpack-hot-middleware": "^2.2.0"
  }
}
3
  • Can you post your full package.json? Commented Jun 15, 2016 at 10:08
  • Hi, Thanks for the response. I have added the complete package.json. Commented Jun 15, 2016 at 12:00
  • Please have a look at your package json's scripts section Commented Mar 30, 2017 at 18:16

5 Answers 5

4

you have to change "main" in package.json to server.js

also you can do:

"scripts": {
  "start": "node server.js",
  "test": "mocha",
  "postinstall": "bower install && grunt build"
}

https://devcenter.heroku.com/articles/nodejs-support#customizing-the-build-process

https://scotch.io/tutorials/how-to-deploy-a-node-js-app-to-heroku

Sign up to request clarification or add additional context in comments.

2 Comments

HI, Thanks for the response. I tried doing that. That didn't work either.
As an alternative, you can specify in Procfile: web: node index.js ** see stackoverflow.com/questions/34631300/…
1

I had the same issue and my server was on app.js file I changed my package.json file as below:

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

and Procfile as

web: node app.js

and I redo the heroku creating procedure heroku app create procedure

this is the link to it : https://devcenter.heroku.com/articles/deploying-nodejs#deploy-your-application-to-heroku

I think this will be helpful

Comments

0

Everything looks correct. Make sure that the Procfile is named correctly and is in the correct folder.

Comments

0

There is a possibility that the issue is how your files are nested. If you have a git repository with another file inside it that has the code, the pa

1 Comment

Did you accidentally deleted a part of your answer? The last sentence seems incomplete.
0

I have the three js same name as well as my main js file, it works to me.

In package.json.
"main": "app.js", "scripts": { "start": "node app.js" }

and in Procfile
web:node app.js

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.