0

I'm new to heroku and when running my node.js app for the first time I get an application error. I have trouble discerning what exactly is the issue since the program runs fine locally. Here is the log. I can post the node.js code if need be, but specfically I know

http.listen(process.env.PORT || 3000, function(){
console.log('listening on *:3000');
});

should be right

2016-06-06T23:38:54.950995+00:00 heroku[api]: Release v2 created by 96benchu@gmail.com
2016-06-06T23:38:54.950923+00:00 heroku[api]: Enable Logplex by 96benchu@gmail.com
2016-06-06T23:39:20.282705+00:00 heroku[api]: Scale to web=1 by 96benchu@gmail.com
2016-06-06T23:39:20.283517+00:00 heroku[api]: Deploy 5244c81 by 96benchu@gmail.com
2016-06-06T23:39:20.283586+00:00 heroku[api]: Release v3 created by 96benchu@gmail.com
2016-06-06T23:39:20.707206+00:00 heroku[slug-compiler]: Slug compilation started
2016-06-06T23:39:20.707211+00:00 heroku[slug-compiler]: Slug compilation finished
2016-06-06T23:39:22.230869+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-06T23:39:24.373251+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-06T23:39:24.373791+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-06T23:39:24.374028+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-06T23:39:24.374471+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-06-06T23:39:24.375629+00:00 app[web.1]:
2016-06-06T23:39:24.376442+00:00 app[web.1]: npm ERR! missing script: start
2016-06-06T23:39:24.376571+00:00 app[web.1]: npm ERR!
2016-06-06T23:39:24.376669+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-06T23:39:24.376763+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2016-06-06T23:39:24.384251+00:00 app[web.1]:
2016-06-06T23:39:24.384417+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-06T23:39:24.384520+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-06-06T23:39:25.117419+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-06T23:39:25.118722+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-06T23:39:25.105763+00:00 heroku[web.1]: Process exited with status 1
2016-06-06T23:39:26.845316+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-06T23:39:30.360228+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-06T23:39:30.360970+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-06T23:39:30.361314+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-06T23:39:30.362144+00:00 app[web.1]: npm ERR! npm  v3.8.6
2016-06-06T23:39:30.364140+00:00 app[web.1]:
2016-06-06T23:39:30.365320+00:00 app[web.1]: npm ERR! missing script: start
2016-06-06T23:39:30.365478+00:00 app[web.1]: npm ERR!
2016-06-06T23:39:30.365600+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-06T23:39:30.365735+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2016-06-06T23:39:30.381812+00:00 app[web.1]:
2016-06-06T23:39:30.382074+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-06T23:39:30.382233+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2016-06-06T23:39:31.427206+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-06T23:39:31.409170+00:00 heroku[web.1]: Process exited with status 1
2016-06-06T23:40:10.611044+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secret-eyrie-35026.herokuapp.com request_id=9e530180-b522-4412-a321-54b90430b82f fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
2016-06-06T23:40:11.404313+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secret-eyrie-35026.herokuapp.com request_id=f039df37-b206-41df-80b8-5076330ae67f fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
2016-06-06T23:41:02.960874+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secret-eyrie-35026.herokuapp.com request_id=0ad763f1-7a6f-4324-b9ad-f81891d4ccba fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
2016-06-06T23:41:03.729436+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secret-eyrie-35026.herokuapp.com request_id=790a0e38-360c-447d-80a6-fa57914faf15 fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
Benjamin Chu
  • 151
  • 1
  • 3
  • 7
  • Post your package.json. My guess is you aren't specifying your start script correctly. – user2263572 Jun 07 '16 at 00:30
  • According to error log that you posted you don't have `start` script in your `package.json` file https://github.com/heroku/node-js-getting-started/blob/master/package.json – gevorg Jun 07 '16 at 00:53
  • { "name": "socket-chat-example", "version": "0.0.1", "description": "my first socket.io app", "dependencies": { "express": "~4.10.2", "socket.io": "1.2.0", } } Is the package.json how would I fix that? – Benjamin Chu Jun 07 '16 at 00:57

1 Answers1

3

You can add start script in your package.json like following:

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

so that your package.json will look like following:

{ 
    "name": "socket-chat-example", 
    "version": "0.0.1", 
    "description": "my first socket.io app", 
    "scripts": {
        "start": "node index.js"
    },
    "dependencies": { "express": "~4.10.2", "socket.io": "1.2.0", } 
} 
Codemole
  • 3,069
  • 5
  • 25
  • 41