NodeJS Heroku Deploying Error - node.js

When I was deploying my app to Heroku from github, on my Heroku dashboard it says my app is successfully deployed. However, when I view my app it says Application Error.
So here is my log:
2015-09-09T05:54:41.566570+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-09T05:54:41.566570+00:00 heroku[web.1]: State changed from crashed to starting
2015-09-09T05:54:41.542661+00:00 heroku[web.1]: Process exited with status 1
2015-09-09T05:54:43.511445+00:00 heroku[web.1]: Starting process with command `npm start`
2015-09-09T05:54:45.973805+00:00 app[web.1]:
2015-09-09T05:54:45.973825+00:00 app[web.1]: > mark-wen-home#1.0.0 start /app
2015-09-09T05:54:45.973828+00:00 app[web.1]: > node server.js
2015-09-09T05:54:45.973829+00:00 app[web.1]:
2015-09-09T05:54:46.306616+00:00 app[web.1]: events.js:85
2015-09-09T05:54:46.306620+00:00 app[web.1]: throw er; // Unhandled 'error' event
2015-09-09T05:54:46.306621+00:00 app[web.1]: ^
2015-09-09T05:54:46.306623+00:00 app[web.1]: Error: listen EACCES
2015-09-09T05:54:46.306624+00:00 app[web.1]: at exports._errnoException (util.js:746:11)
2015-09-09T05:54:46.306625+00:00 app[web.1]: at Server._listen2 (net.js:1139:19)
2015-09-09T05:54:46.306626+00:00 app[web.1]: at listen (net.js:1182:10)
2015-09-09T05:54:46.306628+00:00 app[web.1]: at Server.listen (net.js:1267:5)
2015-09-09T05:54:46.306629+00:00 app[web.1]: at EventEmitter.listen (/app/node_modules/express/lib/application.js:617:24)
2015-09-09T05:54:46.306630+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:6:18)
2015-09-09T05:54:46.306631+00:00 app[web.1]: at Module._compile (module.js:460:26)
2015-09-09T05:54:46.306633+00:00 app[web.1]: at Object.Module._extensions..js (module.js:478:10)
2015-09-09T05:54:46.306634+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-09-09T05:54:46.306635+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-09-09T05:54:46.319744+00:00 app[web.1]:
2015-09-09T05:54:46.325322+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-09-09T05:54:46.325562+00:00 app[web.1]: npm ERR! node v0.12.7
2015-09-09T05:54:46.325986+00:00 app[web.1]: npm ERR! npm v2.11.3
2015-09-09T05:54:46.326180+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2015-09-09T05:54:46.326474+00:00 app[web.1]: npm ERR! mark-wen-home#1.0.0 start: `node server.js`
2015-09-09T05:54:46.326627+00:00 app[web.1]: npm ERR! Exit status 1
2015-09-09T05:54:46.326774+00:00 app[web.1]: npm ERR!
2015-09-09T05:54:46.326914+00:00 app[web.1]: npm ERR! Failed at the mark-wen-home#1.0.0 start script 'node server.js'.
2015-09-09T05:54:46.327140+00:00 app[web.1]: npm ERR! This is most likely a problem with the mark-wen-home package,
2015-09-09T05:54:46.327330+00:00 app[web.1]: npm ERR! not with npm itself.
2015-09-09T05:54:46.327495+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-09-09T05:54:46.327804+00:00 app[web.1]: npm ERR! node server.js
2015-09-09T05:54:46.327908+00:00 app[web.1]: npm ERR! You can get their info via:
2015-09-09T05:54:46.328139+00:00 app[web.1]: npm ERR! npm owner ls mark-wen-home
2015-09-09T05:54:46.328335+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-09-09T05:54:46.331322+00:00 app[web.1]:
2015-09-09T05:54:46.331590+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2015-09-09T05:54:46.331796+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2015-09-09T05:54:46.324727+00:00 app[web.1]: npm ERR! Linux 3.13.0-61-generic
2015-09-09T05:54:47.275838+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-09T05:54:47.256020+00:00 heroku[web.1]: Process exited with status 1
2015-09-09T06:02:13.416277+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mark-wen-home.herokuapp.com request_id=1ef25e3b-07c1-4d3c-b076-1340b63418b9 fwd="72.12.205.35" dyno= connect= service= status=503 bytes=
2015-09-09T06:02:13.809318+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mark-wen-home.herokuapp.com request_id=8a4ba90e-6596-40e7-a5a0-72f829a5b90f fwd="72.12.205.35" dyno= connect= service= status=503 bytes=
And here is my server.js in case it is needed:
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/public'));
var server = app.listen(80, function () {
var port = server.address().port;
console.log('Listening at port ' + port);
});
I am new to Heroku, please help me out with this, thanks.

instead of 80, try to use like this (process.env.PORT || 80))

Common issue, try this.
Add a file in your app's root directory: Procfile
It has no extensions, just Procfile
And in this Procfile, add the following
web: node ./bin/www
Recompile and repush, let us know what happens.

Related

Heroku deployment not working with postgresql api

I am working on a nodejs api found on https://www.taniarascia.com/node-express-postgresql-heroku/
it uses postgresql so it requires you to download the postgresql add-on to your app on heroku witch I did, but when I open the app it says cannot get / like expected but I go to the /books and it gives me the heroku error. When I do:
heroku logs -t -a node-api-with-books
it gives me this error:
2021-03-03T03:25:31.515099+00:00 app[web.1]: code: 'ECONNREFUSED',
2021-03-03T03:25:31.515099+00:00 app[web.1]: syscall: 'connect',
2021-03-03T03:25:31.515099+00:00 app[web.1]: address: '127.0.0.1',
2021-03-03T03:25:31.515100+00:00 app[web.1]: port: 5432
2021-03-03T03:25:31.515100+00:00 app[web.1]: }
2021-03-03T03:25:31.542497+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/books" host=node-api-with-books.herokuapp.com request_id=83db8d38-c206-484a-8bca-a273ed8be8bd fwd="66.7.125.54" dyno=web.1 connect=5002ms service=95ms status=503 bytes=0 protocol=https
2021-03-03T03:25:31.578446+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-03T03:25:31.579040+00:00 app[web.1]: npm ERR! errno 1
2021-03-03T03:25:31.653173+00:00 app[web.1]: npm ERR! working-rest-api#1.0.0 start: `node index.js`
2021-03-03T03:25:31.653743+00:00 app[web.1]: npm ERR! Exit status 1
2021-03-03T03:25:31.656417+00:00 app[web.1]: npm ERR!
2021-03-03T03:25:31.656729+00:00 app[web.1]: npm ERR! Failed at the working-rest-api#1.0.0 start script.
2021-03-03T03:25:31.657018+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-03T03:25:31.693198+00:00 app[web.1]:
2021-03-03T03:25:31.700905+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-03T03:25:31.701084+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-03T03_25_31_668Z-debug.log
2021-03-03T03:25:31.868076+00:00 heroku[web.1]: Process exited with status 1
2021-03-03T03:25:32.005535+00:00 heroku[web.1]: State changed from up to crashed
2021-03-03T03:25:32.847159+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=node-api-with-books.herokuapp.com request_id=d669a8bb-5c76-4007-8e20-2323df702196 fwd="66.7.125.54" dyno=web.1 connect=1ms service= status=503 bytes= protocol=https
2021-03-03T03:57:13.968272+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-03T03:57:19.191432+00:00 heroku[web.1]: Starting process with command `npm start`
2021-03-03T03:57:23.003539+00:00 app[web.1]:
2021-03-03T03:57:23.003564+00:00 app[web.1]: > working-rest-api#1.0.0 start /app
2021-03-03T03:57:23.003565+00:00 app[web.1]: > node index.js
2021-03-03T03:57:23.003565+00:00 app[web.1]:
2021-03-03T03:57:23.514091+00:00 app[web.1]: Server listening
2021-03-03T03:57:23.596725+00:00 heroku[web.1]: State changed from starting to up
2021-03-03T04:31:59.242314+00:00 heroku[web.1]: Idling
2021-03-03T04:31:59.270196+00:00 heroku[web.1]: State changed from up to down
2021-03-03T04:32:00.860211+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-03-03T04:32:01.033002+00:00 heroku[web.1]: Process exited with status 143
2021-03-04T23:41:06.257484+00:00 heroku[web.1]: Unidling
2021-03-04T23:41:06.279151+00:00 heroku[web.1]: State changed from down to starting
2021-03-04T23:41:09.533736+00:00 heroku[web.1]: Starting process with command `npm start`
2021-03-04T23:41:13.424801+00:00 app[web.1]:
2021-03-04T23:41:13.424844+00:00 app[web.1]: > working-rest-api#1.0.0 start /app
2021-03-04T23:41:13.424844+00:00 app[web.1]: > node index.js
2021-03-04T23:41:13.424844+00:00 app[web.1]:
2021-03-04T23:41:13.856750+00:00 app[web.1]: Server listening
2021-03-04T23:41:14.426074+00:00 heroku[web.1]: State changed from starting to up
2021-03-04T23:41:15.345417+00:00 heroku[router]: at=info method=GET path="/" host=node-api-with-books.herokuapp.com request_id=1fafdcec-9742-41d6-a530-a15755f7f0cc fwd="66.7.125.54" dyno=web.1 connect=1ms service=11ms status=404 bytes=415 protocol=https
2021-03-04T23:41:20.464200+00:00 app[web.1]: /app/index.js:12
2021-03-04T23:41:20.464217+00:00 app[web.1]: throw err;
2021-03-04T23:41:20.464218+00:00 app[web.1]: ^
2021-03-04T23:41:20.464218+00:00 app[web.1]:
2021-03-04T23:41:20.464219+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:5432
2021-03-04T23:41:20.464222+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
2021-03-04T23:41:20.464223+00:00 app[web.1]: errno: -111,
2021-03-04T23:41:20.464223+00:00 app[web.1]: code: 'ECONNREFUSED',
2021-03-04T23:41:20.464223+00:00 app[web.1]: syscall: 'connect',
2021-03-04T23:41:20.464224+00:00 app[web.1]: address: '127.0.0.1',
2021-03-04T23:41:20.464224+00:00 app[web.1]: port: 5432
2021-03-04T23:41:20.464225+00:00 app[web.1]: }
2021-03-04T23:41:20.477571+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/books" host=node-api-with-books.herokuapp.com request_id=24e2da67-be91-4e17-89b3-debef869bba4 fwd="66.7.125.54" dyno=web.1 connect=1ms service=49ms status=503 bytes=0 protocol=https
2021-03-04T23:41:20.484562+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-04T23:41:20.485036+00:00 app[web.1]: npm ERR! errno 1
2021-03-04T23:41:20.493801+00:00 app[web.1]: npm ERR! working-rest-api#1.0.0 start: `node index.js`
2021-03-04T23:41:20.494105+00:00 app[web.1]: npm ERR! Exit status 1
2021-03-04T23:41:20.494432+00:00 app[web.1]: npm ERR!
2021-03-04T23:41:20.494669+00:00 app[web.1]: npm ERR! Failed at the working-rest-api#1.0.0 start script.
2021-03-04T23:41:20.494947+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-04T23:41:20.511921+00:00 app[web.1]:
2021-03-04T23:41:20.512219+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-04T23:41:20.512381+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-04T23_41_20_495Z-debug.log
2021-03-04T23:41:20.920060+00:00 heroku[web.1]: Process exited with status 1
2021-03-04T23:41:20.981301+00:00 heroku[web.1]: State changed from up to crashed
2021-03-04T23:41:21.001047+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-04T23:41:24.349422+00:00 heroku[web.1]: Starting process with command `npm start`
2021-03-04T23:41:28.760560+00:00 app[web.1]:
2021-03-04T23:41:28.760604+00:00 app[web.1]: > working-rest-api#1.0.0 start /app
2021-03-04T23:41:28.760605+00:00 app[web.1]: > node index.js
2021-03-04T23:41:28.760605+00:00 app[web.1]:
2021-03-04T23:41:29.460226+00:00 app[web.1]: Server listening
2021-03-04T23:41:29.767594+00:00 heroku[web.1]: State changed from starting to up
2021-03-04T23:41:30.782783+00:00 app[web.1]: /app/index.js:12
2021-03-04T23:41:30.782799+00:00 app[web.1]: throw err;
2021-03-04T23:41:30.782800+00:00 app[web.1]: ^
2021-03-04T23:41:30.782800+00:00 app[web.1]:
2021-03-04T23:41:30.782801+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:5432
2021-03-04T23:41:30.782802+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
2021-03-04T23:41:30.782802+00:00 app[web.1]: errno: -111,
2021-03-04T23:41:30.782803+00:00 app[web.1]: code: 'ECONNREFUSED',
2021-03-04T23:41:30.782803+00:00 app[web.1]: syscall: 'connect',
2021-03-04T23:41:30.782803+00:00 app[web.1]: address: '127.0.0.1',
2021-03-04T23:41:30.782804+00:00 app[web.1]: port: 5432
2021-03-04T23:41:30.782804+00:00 app[web.1]: }
2021-03-04T23:41:30.806119+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/books" host=node-api-with-books.herokuapp.com request_id=0476a454-a185-465c-9df3-f5e0adf6ec8f fwd="66.7.125.54" dyno=web.1 connect=1ms service=143ms status=503 bytes=0 protocol=https
2021-03-04T23:41:30.897859+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-04T23:41:30.901791+00:00 app[web.1]: npm ERR! errno 1
2021-03-04T23:41:30.940174+00:00 app[web.1]: npm ERR! working-rest-api#1.0.0 start: `node index.js`
2021-03-04T23:41:30.941393+00:00 app[web.1]: npm ERR! Exit status 1
2021-03-04T23:41:30.942380+00:00 app[web.1]: npm ERR!
2021-03-04T23:41:30.942813+00:00 app[web.1]: npm ERR! Failed at the working-rest-api#1.0.0 start script.
2021-03-04T23:41:30.943425+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-04T23:41:31.316808+00:00 app[web.1]:
2021-03-04T23:41:31.316994+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-04T23:41:31.317190+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-04T23_41_30_947Z-debug.log
2021-03-04T23:41:31.419624+00:00 heroku[web.1]: Process exited with status 1
2021-03-04T23:41:31.527952+00:00 heroku[web.1]: State changed from up to crashed
2021-03-04T23:41:32.128408+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=node-api-with-books.herokuapp.com request_id=7909f853-52aa-43dc-a228-3190e28b31b9 fwd="66.7.125.54" dyno=web.1 connect=0ms service= status=503 bytes= protocol=https
Is there any part of this that I should focus on and how do I make it work?
You might need to look at this to understand better https://www.taniarascia.com/node-express-postgresql-heroku/
Your are trying to connect to local postgreSQL database from heroku, try to set a new environment variable in heroku dashboard like this :
NODE_ENV=production
or
You need to set up all your env. var with add-ons value like this :
DB_USER=[your-add-on-user]
DB_PASSWORD=[your-add-on-pass]
DB_HOST=[your-add-on-host]
DB_PORT=5432
DB_DATABASE=[your-add-on-database]
source : https://www.taniarascia.com/node-express-postgresql-heroku/#environment-variables

Heroku error code: Elifecycle +more unknowns

I'm attempting to launch my MERN stack app with Heroku, it works on my localhost but following the directions for heroku, I keep getting this H10 error and I feel like it is something trivial that I've missed. I've hit a wall.
I've looked at the logs, and nothing was helpful, changed the URL, updated the package.json. I originally had too many pkg.json (one in the main folder and one in each of the front and backends), deleted the main folder pkg.json, it's not a node error
heroku logs
2019-05-06T01:22:20.905343+00:00 heroku[web.1]: State changed from crashed to starting
2019-05-06T01:22:20.635909+00:00 app[web.1]: > coding-challenge#1.0.0 start /app
2019-05-06T01:22:20.635910+00:00 app[web.1]: > node server.js
2019-05-06T01:22:20.826762+00:00 app[web.1]: internal/modules/cjs/loader.js:611
2019-05-06T01:22:20.826766+00:00 app[web.1]: throw err;
2019-05-06T01:22:20.826768+00:00 app[web.1]: ^
2019-05-06T01:22:20.826771+00:00 app[web.1]: Error: Cannot find module 'cors'
2019-05-06T01:22:20.826773+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
2019-05-06T01:22:20.826775+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:535:25)
2019-05-06T01:22:20.826776+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:663:17)
2019-05-06T01:22:20.826777+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2019-05-06T01:22:20.826779+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2019-05-06T01:22:20.826780+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:734:30)
2019-05-06T01:22:20.826781+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
2019-05-06T01:22:20.826782+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:626:32)
2019-05-06T01:22:20.826783+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
2019-05-06T01:22:20.826785+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:558:3)
2019-05-06T01:22:20.833856+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-05-06T01:22:20.834362+00:00 app[web.1]: npm ERR! errno 1
2019-05-06T01:22:20.835547+00:00 app[web.1]: npm ERR! coding-challenge#1.0.0 start: `node server.js`
2019-05-06T01:22:20.835696+00:00 app[web.1]: npm ERR! Exit status 1
2019-05-06T01:22:20.835933+00:00 app[web.1]: npm ERR!
2019-05-06T01:22:20.836101+00:00 app[web.1]: npm ERR! Failed at the coding-challenge#1.0.0 start script.
2019-05-06T01:22:20.836250+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-05-06T01:22:20.843776+00:00 app[web.1]:
2019-05-06T01:22:20.843920+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-05-06T01:22:20.844004+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-05-06T01_22_20_837Z-debug.log
2019-05-06T01:22:20.885179+00:00 heroku[web.1]: Process exited with status 1
2019-05-06T01:22:23.822929+00:00 heroku[web.1]: Starting process with command `npm start`
2019-05-06T01:22:26.506313+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-06T01:22:26.221158+00:00 app[web.1]:
2019-05-06T01:22:26.221187+00:00 app[web.1]: > coding-challenge#1.0.0 start /app
2019-05-06T01:22:26.221190+00:00 app[web.1]: > node server.js
2019-05-06T01:22:26.221192+00:00 app[web.1]:
2019-05-06T01:22:26.431669+00:00 app[web.1]: internal/modules/cjs/loader.js:611
2019-05-06T01:22:26.431673+00:00 app[web.1]: throw err;
2019-05-06T01:22:26.431674+00:00 app[web.1]: ^
2019-05-06T01:22:26.431676+00:00 app[web.1]:
2019-05-06T01:22:26.431678+00:00 app[web.1]: Error: Cannot find module 'cors'
2019-05-06T01:22:26.431680+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
2019-05-06T01:22:26.431682+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:535:25)
2019-05-06T01:22:26.431684+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:663:17)
2019-05-06T01:22:26.431687+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2019-05-06T01:22:26.431688+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2019-05-06T01:22:26.431690+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:734:30)
2019-05-06T01:22:26.431692+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
2019-05-06T01:22:26.431694+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:626:32)
2019-05-06T01:22:26.431695+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
2019-05-06T01:22:26.431697+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:558:3)
2019-05-06T01:22:26.438865+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-05-06T01:22:26.439262+00:00 app[web.1]: npm ERR! errno 1
2019-05-06T01:22:26.440416+00:00 app[web.1]: npm ERR! coding-challenge#1.0.0 start: `node server.js`
2019-05-06T01:22:26.440555+00:00 app[web.1]: npm ERR! Exit status 1
2019-05-06T01:22:26.440783+00:00 app[web.1]: npm ERR!
2019-05-06T01:22:26.440937+00:00 app[web.1]: npm ERR! Failed at the coding-challenge#1.0.0 start script.
2019-05-06T01:22:26.441081+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-05-06T01:22:26.448596+00:00 app[web.1]:
2019-05-06T01:22:26.448750+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-05-06T01:22:26.448803+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-05-06T01_22_26_442Z-debug.log
2019-05-06T01:22:26.493385+00:00 heroku[web.1]: Process exited with status 1
2019-05-06T01:45:52.690438+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-wildwood-76480.herokuapp.com request_id=b1c76bb1-2948-45cd-929b-b579eb45e29b fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
2019-05-06T01:45:54.362863+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-wildwood-76480.herokuapp.com request_id=df6c81f1-df99-4d50-af11-baff32648e77 fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
2019-05-06T01:53:45.184100+00:00 heroku[web.1]: State changed from crashed to starting
2019-05-06T01:53:48.182538+00:00 heroku[web.1]: Starting process with command `npm start`
2019-05-06T01:53:51.404026+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-06T01:53:50.980526+00:00 app[web.1]:
2019-05-06T01:53:50.980548+00:00 app[web.1]: > coding-challenge#1.0.0 start /app
2019-05-06T01:53:50.980551+00:00 app[web.1]: > node server.js
2019-05-06T01:53:50.980552+00:00 app[web.1]:
2019-05-06T01:53:51.263052+00:00 app[web.1]: internal/modules/cjs/loader.js:611
2019-05-06T01:53:51.263083+00:00 app[web.1]: throw err;
2019-05-06T01:53:51.263084+00:00 app[web.1]: ^
2019-05-06T01:53:51.263086+00:00 app[web.1]:
2019-05-06T01:53:51.263087+00:00 app[web.1]: Error: Cannot find module 'cors'
2019-05-06T01:53:51.263089+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
2019-05-06T01:53:51.263091+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:535:25)
2019-05-06T01:53:51.263093+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:663:17)
2019-05-06T01:53:51.263094+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2019-05-06T01:53:51.263096+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2019-05-06T01:53:51.263097+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:734:30)
2019-05-06T01:53:51.263099+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
2019-05-06T01:53:51.263100+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:626:32)
2019-05-06T01:53:51.263102+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
2019-05-06T01:53:51.263103+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:558:3)
2019-05-06T01:53:51.274764+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-05-06T01:53:51.274769+00:00 app[web.1]: npm ERR! errno 1
2019-05-06T01:53:51.278740+00:00 app[web.1]: npm ERR! coding-challenge#1.0.0 start: `node server.js`
2019-05-06T01:53:51.278744+00:00 app[web.1]: npm ERR! Exit status 1
2019-05-06T01:53:51.278746+00:00 app[web.1]: npm ERR!
2019-05-06T01:53:51.278748+00:00 app[web.1]: npm ERR! Failed at the coding-challenge#1.0.0 start script.
2019-05-06T01:53:51.278750+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-05-06T01:53:51.287320+00:00 app[web.1]:
2019-05-06T01:53:51.287325+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-05-06T01:53:51.287327+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-05-06T01_53_51_279Z-debug.log
2019-05-06T01:53:51.386095+00:00 heroku[web.1]: Process exited with status 1
2019-05-06T02:07:06.872526+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-wildwood-76480.herokuapp.com request_id=c14c2030-244d-469e-8953-d99d8e1d6fe8 fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
2019-05-06T02:07:08.695039+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-wildwood-76480.herokuapp.com request_id=3532bee8-9b55-43ed-87ec-9bd7c2706efb fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
Looks like the module cors hasn't been installed. I think Heroku should automatically run npm install in your project for you, but you have to list the dependencies in your package.json.
Inside package.json do you have the cors dependency inside the dependencies object? If not you should add it so it looks something like
// package.json
{
"dependencies": {
"cors": "*"
}
}

Heroku + Node.js (express) - Application Error

I'm writing a basic Node.js HTTP request&response application following a step-by-step tutorial.
After deploying to Heroku if I visit the URL I get an "Application Error".
It has already happened the same. I waited some time, deleted the Heroku app, pushed the Heroku app back and it was working fine again.
Then it stopped again.
If I try GET and POST queries (via Postman) I get a "503 Service Unavailable" error.
I attach the Heroku Log that tells me to open a node issue but locally (localhost:3000) is working fine.
The error is H10 "App Crashed"
Maybe someone knows what the issue is.
I attach my Node.js code:
var express = require('express');
var bodyParser = require('body-Parser');
var _ = require('underscore');
var app = express();
var PORT = process.env.PORT || 3000;
var todos = [];
var todoNextId = 1;
app.use(bodyParser.json());
//GET /[root]
app.get('/', function (req, res) {
res.send('Todo API Root');
});
//GET /todos
app.get('/todos', function (req, res) {
res.json(todos);
});
//GET /todos/:id
app.get('/todos/:id', function (req, res) {
var todoId = parseInt(req.params.id);
var matchedToDo = _.findWhere(todos, {id: todoId});
if (matchedToDo) {
res.json(matchedToDo);
} else {
res.status(404).send();
}
});
//POST /todos
app.post('/todos', function (req, res) {
var body = _.pick(req.body, 'description', 'completed');
if (!_.isBoolean(body.completed) || !_.isString(body.description) || body.description.trim().length === 0) {
return res.status(400).send();
}
body.description = body.description.trim();
body.id = todoNextId++;
todos.push(body);
res.json(body);
});
app.listen(PORT, function (){
console.log('Express listening on port ' + PORT);
});
Thanks for helping.
2016-05-02T17:08:52.094535+00:00 heroku[api]: Enable Logplex by xxx#gmail.com 2016-05-02T17:08:52.094582+00:00 heroku[api]: Release v2 created by xxx#gmail.com
2016-05-02T17:10:19.718255+00:00 heroku[api]: Scale to web=1 by xxx#gmail.com
2016-05-02T17:10:19.719361+00:00 heroku[api]: Release v3 created by xxx#gmail.com
2016-05-02T17:10:19.719361+00:00 heroku[api]: Deploy 7c303de by xxx#gmail.com
2016-05-02T17:10:20.663812+00:00 heroku[slug-compiler]: Slug compilation started
2016-05-02T17:10:20.663829+00:00 heroku[slug-compiler]: Slug compilation finished
2016-05-02T17:10:22.387983+00:00 heroku[web.1]: Starting process with command `npm start`
2016-05-02T17:10:24.378611+00:00 app[web.1]: > todo-api#1.0.0 start /app
2016-05-02T17:10:24.378615+00:00 app[web.1]: > node server.js
2016-05-02T17:10:24.378616+00:00 app[web.1]:
2016-05-02T17:10:24.378601+00:00 app[web.1]:
2016-05-02T17:10:24.539535+00:00 app[web.1]: ^
2016-05-02T17:10:24.539505+00:00 app[web.1]: module.js:327
2016-05-02T17:10:24.539535+00:00 app[web.1]:
2016-05-02T17:10:24.539533+00:00 app[web.1]: throw err;
2016-05-02T17:10:24.539538+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-05-02T17:10:24.539539+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-05-02T17:10:24.539537+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:325:15)
2016-05-02T17:10:24.539538+00:00 app[web.1]: at Function.Module._load (module.js:276:25)
2016-05-02T17:10:24.539539+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:2:18)
2016-05-02T17:10:24.539541+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-05-02T17:10:24.539543+00:00 app[web.1]: at Function.Module.runMain (module.js:441:10)
2016-05-02T17:10:24.539541+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-05-02T17:10:24.539540+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-05-02T17:10:24.539536+00:00 app[web.1]: Error: Cannot find module 'body-Parser'
2016-05-02T17:10:24.552923+00:00 app[web.1]: npm ERR! Linux 3.13.0-79-generic
2016-05-02T17:10:24.553580+00:00 app[web.1]: npm ERR! node v4.4.3
2016-05-02T17:10:24.546698+00:00 app[web.1]:
2016-05-02T17:10:24.554229+00:00 app[web.1]: npm ERR! npm v2.15.1
2016-05-02T17:10:24.555005+00:00 app[web.1]: npm ERR! Exit status 1
2016-05-02T17:10:24.539542+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-05-02T17:10:24.554626+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-05-02T17:10:24.555172+00:00 app[web.1]: npm ERR!
2016-05-02T17:10:24.555617+00:00 app[web.1]: npm ERR! not with npm itself.
2016-05-02T17:10:24.555698+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-05-02T17:10:24.555885+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-05-02T17:10:24.555495+00:00 app[web.1]: npm ERR! This is most likely a problem with the todo-api package,
2016-05-02T17:10:24.554849+00:00 app[web.1]: npm ERR! todo-api#1.0.0 start: `node server.js`
2016-05-02T17:10:24.553350+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-05-02T17:10:24.556081+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-05-02T17:10:24.555346+00:00 app[web.1]: npm ERR! Failed at the todo-api#1.0.0 start script 'node server.js'.
2016-05-02T17:10:24.556309+00:00 app[web.1]: npm ERR! npm owner ls todo-api
2016-05-02T17:10:24.555786+00:00 app[web.1]: npm ERR! node server.js
2016-05-02T17:10:24.555982+00:00 app[web.1]: npm ERR! npm bugs todo-api
2016-05-02T17:10:24.556157+00:00 app[web.1]: npm ERR!
2016-05-02T17:10:24.559818+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-05-02T17:10:24.559924+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-05-02T17:10:24.556417+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-05-02T17:10:24.559659+00:00 app[web.1]:
2016-05-02T17:10:25.340763+00:00 heroku[web.1]: State changed from starting to crashed
2016-05-02T17:10:25.341871+00:00 heroku[web.1]: State changed from crashed to starting
2016-05-02T17:10:25.335969+00:00 heroku[web.1]: Process exited with status 1
2016-05-02T17:10:26.442330+00:00 heroku[web.1]: Starting process with command `npm start`
2016-05-02T17:10:29.267867+00:00 app[web.1]:
2016-05-02T17:10:29.267893+00:00 app[web.1]: > todo-api#1.0.0 start /app
2016-05-02T17:10:29.267895+00:00 app[web.1]:
2016-05-02T17:10:29.267894+00:00 app[web.1]: > node server.js
2016-05-02T17:10:29.703937+00:00 app[web.1]: module.js:327
2016-05-02T17:10:29.703975+00:00 app[web.1]: throw err;
2016-05-02T17:10:29.703978+00:00 app[web.1]: ^
2016-05-02T17:10:29.703978+00:00 app[web.1]:
2016-05-02T17:10:29.703985+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:325:15)
2016-05-02T17:10:29.703988+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-05-02T17:10:29.703989+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-05-02T17:10:29.703990+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-05-02T17:10:29.721879+00:00 app[web.1]:
2016-05-02T17:10:29.733721+00:00 app[web.1]: npm ERR! Linux 3.13.0-79-generic
2016-05-02T17:10:29.703990+00:00 app[web.1]: at Function.Module.runMain (module.js:441:10)
2016-05-02T17:10:29.734824+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-05-02T17:10:29.703987+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-05-02T17:10:29.703984+00:00 app[web.1]: Error: Cannot find module 'body-Parser'
2016-05-02T17:10:29.703988+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:2:18)
2016-05-02T17:10:29.703986+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-05-02T17:10:29.703989+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-05-02T17:10:29.703986+00:00 app[web.1]: at Function.Module._load (module.js:276:25)
2016-05-02T17:10:29.737258+00:00 app[web.1]: npm ERR! npm v2.15.1
2016-05-02T17:10:29.737687+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-05-02T17:10:29.735275+00:00 app[web.1]: npm ERR! node v4.4.3
2016-05-02T17:10:29.738035+00:00 app[web.1]: npm ERR! todo-api#1.0.0 start: `node server.js`
2016-05-02T17:10:29.738349+00:00 app[web.1]: npm ERR! Exit status 1
2016-05-02T17:10:29.738718+00:00 app[web.1]: npm ERR!
2016-05-02T17:10:29.739200+00:00 app[web.1]: npm ERR! Failed at the todo-api#1.0.0 start script 'node server.js'.
2016-05-02T17:10:29.740147+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-05-02T17:10:29.739540+00:00 app[web.1]: npm ERR! This is most likely a problem with the todo-api package,
2016-05-02T17:10:29.739862+00:00 app[web.1]: npm ERR! not with npm itself.
2016-05-02T17:10:29.740460+00:00 app[web.1]: npm ERR! node server.js
2016-05-02T17:10:29.740772+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-05-02T17:10:29.741082+00:00 app[web.1]: npm ERR! npm bugs todo-api
2016-05-02T17:10:29.741644+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-05-02T17:10:29.741966+00:00 app[web.1]: npm ERR!
2016-05-02T17:10:29.742244+00:00 app[web.1]: npm ERR! npm owner ls todo-api
2016-05-02T17:10:29.742560+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-05-02T17:10:29.747872+00:00 app[web.1]:
2016-05-02T17:10:29.748529+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-05-02T17:10:29.748823+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-05-02T17:10:30.824809+00:00 heroku[web.1]: Process exited with status 1
2016-05-02T17:10:30.842383+00:00 heroku[web.1]: State changed from starting to crashed
2016-05-02T17:10:34.224806+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=matteo-todo-api.herokuapp.com request_id=f4914bf6-ae6a-4390-a598-ba1e2aa6d598 fwd="2.233.72.96" dyno= connect= service= status=503 bytes=
2016-05-02T17:10:35.375423+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=matteo-todo-api.herokuapp.com request_id=69fe5fe5-9945-4a77-8ca9-564389b58aa9 fwd="2.233.72.96" dyno= connect= service= status=503 bytes=
you have wrong dependency. body-Parser should be body-parser. small "p" not capital "P".

why is my heroku app crashing?

It's my first time trying to deploy an app on heroku and I am getting an application error, code H10 and H13.
This is what I see in my log:
2016-03-13T00:12:52.715324+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0
.1:27017
2016-03-13T00:12:52.715325+00:00 app[web.1]: at Object.exports._errnoExcepti
on (util.js:890:11)
2016-03-13T00:12:52.715325+00:00 app[web.1]: at exports._exceptionWithHostPo
rt (util.js:913:20)
2016-03-13T00:12:52.715326+00:00 app[web.1]: at TCPConnectWrap.afterConnect
[as oncomplete] (net.js:1057:14)
2016-03-13T00:12:52.723973+00:00 app[web.1]:
2016-03-13T00:12:52.731620+00:00 app[web.1]: npm ERR! Linux 3.13.0-77-generic
2016-03-13T00:12:52.732000+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bi
n/node" "/app/.heroku/node/bin/npm" "start"
2016-03-13T00:12:52.732236+00:00 app[web.1]: npm ERR! node v5.8.0
2016-03-13T00:12:52.732975+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-03-13T00:12:52.732648+00:00 app[web.1]: npm ERR! npm v3.7.3
2016-03-13T00:12:52.733150+00:00 app[web.1]: npm ERR! clementinejs-fcc#1.0.1 sta
rt: `node server.js`
2016-03-13T00:12:52.733317+00:00 app[web.1]: npm ERR! Exit status 1
2016-03-13T00:12:52.733490+00:00 app[web.1]: npm ERR!
2016-03-13T00:12:52.733660+00:00 app[web.1]: npm ERR! Failed at the clementinejs
-fcc#1.0.1 start script 'node server.js'.
2016-03-13T00:12:52.733828+00:00 app[web.1]: npm ERR! Make sure you have the lat
est version of node.js and npm installed.
2016-03-13T00:12:52.733992+00:00 app[web.1]: npm ERR! If you do, this is most li
kely a problem with the clementinejs-fcc package,
2016-03-13T00:12:52.734149+00:00 app[web.1]: npm ERR! not with npm itself.
2016-03-13T00:12:52.734297+00:00 app[web.1]: npm ERR! Tell the author that this
fails on your system:
2016-03-13T00:12:52.734449+00:00 app[web.1]: npm ERR! node server.js
2016-03-13T00:12:52.734593+00:00 app[web.1]: npm ERR! You can get information on
how to open an issue for this project with:
2016-03-13T00:12:52.734754+00:00 app[web.1]: npm ERR! npm bugs clementinejs-
fcc
2016-03-13T00:12:52.734901+00:00 app[web.1]: npm ERR! Or if that isn't available
, you can get their info via:
2016-03-13T00:12:52.735055+00:00 app[web.1]: npm ERR! npm owner ls clementin
ejs-fcc
2016-03-13T00:12:52.735207+00:00 app[web.1]: npm ERR! There is likely additional
logging output above.
2016-03-13T00:12:52.739195+00:00 app[web.1]:
2016-03-13T00:12:52.739538+00:00 app[web.1]: npm ERR! Please include the followi
ng file with any support request:
2016-03-13T00:12:52.739681+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-03-13T00:12:52.704158+00:00 heroku[router]: at=error code=H13 desc="Connect
ion closed without response" method=GET path="/" host=meek-fcc-voting.herokuapp.
com request_id=9479851e-9188-48c2-a73f-f5e27f36e002 fwd="151.229.234.60" dyno=we
b.1 connect=0ms service=39ms status=503 bytes=0
2016-03-13T00:12:53.331859+00:00 heroku[web.1]: State changed from crashed to st
arting
2016-03-13T00:12:53.330847+00:00 heroku[web.1]: State changed from up to crashed
2016-03-13T00:12:53.346439+00:00 heroku[web.1]: Process exited with status 1
2016-03-13T00:12:54.744232+00:00 heroku[web.1]: Starting process with command `n
pm start`
2016-03-13T00:12:57.384566+00:00 app[web.1]:
2016-03-13T00:12:57.384587+00:00 app[web.1]: > clementinejs-fcc#1.0.1 start /app
2016-03-13T00:12:57.384588+00:00 app[web.1]: > node server.js
2016-03-13T00:12:57.384589+00:00 app[web.1]:
2016-03-13T00:12:57.870106+00:00 app[web.1]: { [Error: ENOENT: no such file or d
irectory, open '.env'] errno: -2, code: 'ENOENT', syscall: 'open', path: '.env'
}
2016-03-13T00:12:57.898861+00:00 app[web.1]: Node.js listening on port 36707...
2016-03-13T00:12:58.404112+00:00 heroku[web.1]: State changed from starting to u
p
2016-03-13T00:13:02.175651+00:00 heroku[router]: at=info method=GET path="/favic
on.ico" host=meek-fcc-voting.herokuapp.com request_id=feb309ee-11e8-438c-bcdd-18
60b331cfa8 fwd="151.229.234.60" dyno=web.1 connect=5000ms service=35ms status=30
2 bytes=212
2016-03-13T00:13:02.315106+00:00 app[web.1]:
2016-03-13T00:13:02.315160+00:00 app[web.1]: /app/node_modules/mongodb/lib/serve
r.js:242
2016-03-13T00:13:02.315165+00:00 app[web.1]: process.nextTick(function()
{ throw err; })
2016-03-13T00:13:02.315166+00:00 app[web.1]:
^
2016-03-13T00:13:02.315191+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0
.1:27017
2016-03-13T00:13:02.315193+00:00 app[web.1]: at Object.exports._errnoExcepti
on (util.js:890:11)
2016-03-13T00:13:02.315193+00:00 app[web.1]: at exports._exceptionWithHostPo
rt (util.js:913:20)
2016-03-13T00:13:02.315204+00:00 app[web.1]: at TCPConnectWrap.afterConnect
[as oncomplete] (net.js:1057:14)
2016-03-13T00:13:02.326288+00:00 app[web.1]:
2016-03-13T00:13:02.336078+00:00 app[web.1]: npm ERR! Linux 3.13.0-79-generic
2016-03-13T00:13:02.336527+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bi
n/node" "/app/.heroku/node/bin/npm" "start"
2016-03-13T00:13:02.336879+00:00 app[web.1]: npm ERR! node v5.8.0
2016-03-13T00:13:02.337616+00:00 app[web.1]: npm ERR! npm v3.7.3
2016-03-13T00:13:02.338000+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-03-13T00:13:02.338212+00:00 app[web.1]: npm ERR! clementinejs-fcc#1.0.1 sta
rt: `node server.js`
2016-03-13T00:13:02.338428+00:00 app[web.1]: npm ERR! Exit status 1
2016-03-13T00:13:02.338701+00:00 app[web.1]: npm ERR!
2016-03-13T00:13:02.338916+00:00 app[web.1]: npm ERR! Failed at the clementinejs
-fcc#1.0.1 start script 'node server.js'.
2016-03-13T00:13:02.339076+00:00 app[web.1]: npm ERR! Make sure you have the lat
est version of node.js and npm installed.
2016-03-13T00:13:02.339232+00:00 app[web.1]: npm ERR! If you do, this is most li
kely a problem with the clementinejs-fcc package,
2016-03-13T00:13:02.339647+00:00 app[web.1]: npm ERR! not with npm itself.
2016-03-13T00:13:02.339873+00:00 app[web.1]: npm ERR! Tell the author that this
fails on your system:
2016-03-13T00:13:02.340099+00:00 app[web.1]: npm ERR! node server.js
2016-03-13T00:13:02.340319+00:00 app[web.1]: npm ERR! You can get information on
how to open an issue for this project with:
2016-03-13T00:13:02.340932+00:00 app[web.1]: npm ERR! npm bugs clementinejs-
fcc
2016-03-13T00:13:02.341092+00:00 app[web.1]: npm ERR! Or if that isn't available
, you can get their info via:
2016-03-13T00:13:02.344061+00:00 app[web.1]: npm ERR! npm owner ls clementin
ejs-fcc
2016-03-13T00:13:02.344238+00:00 app[web.1]: npm ERR! There is likely additional
logging output above.
2016-03-13T00:13:02.349176+00:00 app[web.1]:
2016-03-13T00:13:02.349587+00:00 app[web.1]: npm ERR! Please include the followi
ng file with any support request:
2016-03-13T00:13:02.349872+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-03-13T00:13:02.335731+00:00 heroku[router]: at=error code=H13 desc="Connect
ion closed without response" method=GET path="/" host=meek-fcc-voting.herokuapp.
com request_id=e27992b9-29a9-49f7-ad05-c8b5fb610c3e fwd="151.229.234.60" dyno=we
b.1 connect=1ms service=43ms status=503 bytes=0
2016-03-13T00:13:03.171457+00:00 heroku[web.1]: Process exited with status 1
2016-03-13T00:13:03.188703+00:00 heroku[web.1]: State changed from up to crashed
2016-03-13T00:14:24.503648+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=meek-fcc-voting.herokuapp.com request_id=84c9f8a2
-2c33-4bcb-9a73-2a438b50700a fwd="151.229.234.60" dyno= connect= service= status
=503 bytes=
2016-03-13T00:14:24.879521+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=meek-fcc-voting.herokuapp.com request_
id=7d863bd0-4287-477f-b815-9528c9ee16ac fwd="151.229.234.60" dyno= connect= serv
ice= status=503 bytes=
It mention an npm debug log, but I have no idea where to find it. It's not in the app directory of the project.
I've tried to to heroku restart with no luck. If you have any idea what I'm missing I'd very much appreciate any help.
edit:
my config vars are
APP_URL=https://meek-fcc-voting.herokuapp.com/
MONGO_URI=mongodb://localhost:27017/
You need to setup your environment variables on Heroku. You can do it via the command line, or on the Settings Page. You can also use Heroku AddOns to get a MongoDB setup for you, which automatically adds the environment variables for connecting to it.

Node.js application on Heroku: failed with exit status 8 - application-name package?

2014-08-18T06:12:54.374054+00:00 app[web.1]: npm ERR! node app.js
2014-08-18T06:12:54.374153+00:00 app[web.1]: npm ERR! You can get their info via:
2014-08-18T06:12:53.681620+00:00 app[web.1]:
2014-08-18T06:12:53.681638+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-08-18T06:12:53.681641+00:00 app[web.1]: > node app.js
2014-08-18T06:12:53.681642+00:00 app[web.1]:
2014-08-18T09:08:41.257725+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2014-08-18T09:08:41.258006+00:00 app[web.1]: npm ERR! npm owner ls application-name
2014-08-18T09:08:41.257553+00:00 app[web.1]: npm ERR! This is most likely a problem with the application-name package,
2014-08-18T09:08:41.200012+00:00 app[web.1]:
2014-08-18T09:08:41.256092+00:00 app[web.1]: npm ERR! Failed at the application-name#0.0.1 start script.
2014-08-18T09:08:41.328006+00:00 app[web.1]: npm ERR! not ok code 0
2014-08-18T09:08:41.257897+00:00 app[web.1]: npm ERR! You can get their info via:
2014-08-18T09:08:41.255669+00:00 app[web.1]: npm ERR! application-name#0.0.1 start: `node app.js`
2014-08-18T09:08:41.256012+00:00 app[web.1]: npm ERR!
2014-08-18T09:08:41.255860+00:00 app[web.1]: npm ERR! Exit status 8
2014-08-18T09:08:41.260452+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2014-08-18T09:08:41.257637+00:00 app[web.1]: npm ERR! not with npm itself.
2014-08-18T09:08:41.305747+00:00 app[web.1]: npm ERR! command "/app/vendor/node/bin/node" "/app/vendor/node/bin/npm" "start"
2014-08-18T09:08:41.257819+00:00 app[web.1]: npm ERR! node app.js
2014-08-18T1
5:48:38.818790+00:00 app[web.1]: Error: Most middleware (like json) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.
2014-08-18T15:48:38.818796+00:00 app[web.1]: at Function.Object.defineProperty.get (/app/node_modules/express/lib/express.js:89:13)
2014-08-18T15:48:38.818798+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:37:17)
2014-08-18T15:48:38.818800+00:00 app[web.1]: at Module._compile (module.js:456:26)
2014-08-18T15:48:38.818802+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2014-08-18T15:48:38.818803+00:00 app[web.1]: at Module.load (module.js:356:32)
2014-08-18T15:48:38.818804+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2014-08-18T15:48:38.818806+00:00 app[web.1]: at Function.Module.runMain (module.js:497:10)
2014-08-18T15:48:38.818808+00:00 app[web.1]: at startup (node.js:119:16)
2014-08-18T15:48:38.818809+00:00 app[web.1]: at node.js:906:3
2014-08-18T15:48:38.852005+00:00 app[web.1]:
2014-08-18T15:48:38.963950+00:00 app[web.1]: npm ERR! Exit status 8
2014-08-18T15:48:38.964092+00:00 app[web.1]: npm ERR!
2014-08-18T15:48:38.964243+00:00 app[web.1]: npm ERR! Failed at the application-name#0.0.1 start script.
2014-08-18T15:48:38.964845+00:00 app[web.1]: npm ERR! This is most likely a problem with the application-name package,
2014-08-18T15:48:38.964941+00:00 app[web.1]: npm ERR! not with npm itself.
2014-08-18T15:48:38.965068+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2014-08-18T15:48:38.972537+00:00 app[web.1]: npm ERR! node app.js
2014-08-18T15:48:38.972644+00:00 app[web.1]: npm ERR! You can get their info via:
2014-08-18T15:48:38.972791+00:00 app[web.1]: npm ERR! npm owner ls application-name
2014-08-18T15:48:38.972864+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2014-08-18T15:48:39.003054+00:00 app[web.1]: npm ERR! System Linux 3.8.11-ec2
2014-08-18T15:48:39.003239+00:00 app[web.1]: npm ERR! command "/app/vendor/node/bin/node" "/app/vendor/node/bin/npm" "start"
2014-08-18T15:48:39.003377+00:00 app[web.1]: npm ERR! cwd /app
2014-08-18T15:48:39.034280+00:00 app[web.1]: npm ERR! node -v v0.10.30
2014-08-18T15:48:39.034505+00:00 app[web.1]: npm ERR! npm -v 1.4.21
2014-08-18T15:48:39.034627+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2014-08-18T15:48:39.053234+00:00 app[web.1]: npm ERR!
2014-08-18T15:48:39.053356+00:00 app[web.1]: npm ERR! Additional logging details can be found in:
2014-08-18T15:48:39.053445+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2014-08-18T15:48:39.053666+00:00 app[web.1]: npm ERR! not ok code 0
2014-08-18T15:48:34.297578+00:00 app[web.1]:
2014-08-18T15:48:34.297596+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-08-18T15:48:34.297598+00:00 app[web.1]: > node app.js
2014-08-18T15:48:34.297599+00:00 app[web.1]:
2014-08-18T15:48:38.807843+00:00 app[web.1]:
2014-08-18T15:48:38.963600+00:00 app[web.1]: npm ERR! application-name#0.0.1 start: `node app.js`
2014-08-19T01:18:03.335113+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=www.supercuber.com request_id=2a27f766-9eba-4b64-a2eb-be9d666cbc6f fwd="208.115.111.73" dyno= connect= service= status=503 bytes=
2014-08-19T06:27:09.423387+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=supercuber.com request_id=cc9ecb87-a01f-4d75-97c9-83327bc0ea12 fwd="188.40.249.84" dyno= connect= service= status=503 bytes=
2014-08-19T07:29:59.457621+00:00 heroku[web.1]: State changed from crashed to starting
2014-08-19T07:30:05.636929+00:00 app[web.1]:
2014-08-19T07:30:05.636950+00:00 app[web.1]:
2014-08-19T07:30:05.636947+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-08-19T07:30:06.272653+00:00 app[web.1]: npm ERR! This is most likely a problem with the application-name package,
2014-08-19T07:30:06.274102+00:00 app[web.1]: npm ERR! node -v v0.10.30
2014-08-19T07:30:06.272136+00:00 app[web.1]: npm ERR! Failed at the application-name#0.0.1 start script.
2014-08-19T07:30:06.274218+00:00 app[web.1]: npm ERR! npm -v 1.4.21
2014-08-19T07:30:06.251287+00:00 app[web.1]:
2014-08-19T07:30:06.273691+00:00 app[web.1]: npm ERR! System Linux 3.8.11-ec2
2014-08-19T07:30:06.275894+00:00 app[web.1]: npm ERR!
2014-08-19T07:30:06.273411+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2014-08-19T07:30:06.276020+00:00 app[web.1]: npm ERR! Additional logging details can be found in:
2014-08-19T07:30:06.272036+00:00 app[web.1]: npm ERR!
2014-08-19T07:30:06.273990+00:00 app[web.1]: npm ERR! cwd /app
2014-08-19T07:30:05.636949+00:00 app[web.1]: > node app.js
2014-08-19T07:30:06.273008+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2014-08-19T07:30:06.273285+00:00 app[web.1]: npm ERR! npm owner ls application-name
2014-08-19T07:30:06.276125+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2014-08-19T07:30:06.273186+00:00 app[web.1]: npm ERR! You can get their info via:
2014-08-19T07:30:06.274337+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2014-08-19T07:30:06.271697+00:00 app[web.1]: npm ERR! application-name#0.0.1 start: `node app.js`
2014-08-19T07:30:06.272746+00:00 app[web.1]: npm ERR! not with npm itself.
2014-08-19T07:30:06.273099+00:00 app[web.1]: npm ERR! node app.js
2014-08-19T07:30:06.271900+00:00 app[web.1]: npm ERR! Exit status 8
2014-08-19T07:30:06.273861+00:00 app[web.1]: npm ERR! command "/app/vendor/node/bin/node" "/app/vendor/node/bin/npm" "start"
2014-08-19T07:30:07.487403+00:00 heroku[web.1]: State changed from starting to crashed
2014-08-19T13:13:46.311103+00:00 heroku[web.1]: Process exited with status 1
2014-08-19T13:13:43.465194+00:00 heroku[web.1]: Starting process with command `npm start`
2014-08-20T01:13:05.625215+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/BingSiteAuth.xml" host=www.supercuber.com request_id=60a05958-5b68-45b3-896d-4ffda351783e fwd="131.253.38.67" dyno= connect= service= status=503 bytes=
2014-08-20T01:13:05.480594+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www.supercuber.com request_id=4ff53541-8a8d-43b6-a39c-db40924c9eac fwd="131.253.38.67" dyno= connect= service= status=503 bytes=
2014-08-20T02:43:17.133291+00:00 app[web.1]: > node app.js
2014-08-20T02:43:17.133270+00:00 app[web.1]:
2014-08-20T02:43:17.133292+00:00 app[web.1]:
2014-08-20T02:43:17.133289+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-08-20T02:43:17.732000+00:00 app[web.1]: npm ERR!
2014-08-20T02:43:17.732121+00:00 app[web.1]: npm ERR! Failed at the application-name#0.0.1 start script.
2014-08-20T02:43:17.710159+00:00 app[web.1]:
2014-08-20T02:43:17.731539+00:00 app[web.1]: npm ERR! application-name#0.0.1 start: `node app.js`
2014-08-20T02:43:17.731795+00:00 app[web.1]: npm ERR! Exit status 8
2014-08-20T02:43:17.733311+00:00 app[web.1]: npm ERR! This is most likely a problem with the application-name package,
2014-08-20T03:10:55.501614+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www.supercuber.com request_id=7ed9a3bd-755c-4d7b-bc23-1a3fa2152919 fwd="98.182.28.116" dyno= connect= service= status=503 bytes=
This is what gets output in my application logs that the error code tells me to check. My research online and here on stack overflow has shown that this error seems to appear for a large variety of use cases, and Im not sure why its appearing now? My application runs fine locally. In fact it used to run on heroku, except when I just made new changes and tried to push them to heroku this happens when I try and start the app.
Edit: here is whats in my app.js currently:
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var cookieParser = require('cookie-parser');
app.use(bodyParser());
app.use(methodOverride());
app.use(cookieParser());
npm is telling you what's wrong:
2014-08-18T15:48:38.818790+00:00 app[web.1]: Error: Most middleware (like json) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.
2014-08-18T15:48:38.818796+00:00 app[web.1]: at Function.Object.defineProperty.get (/app/node_modules/express/lib/express.js:89:13)
2014-08-18T15:48:38.818798+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:37:17)
2014-08-18T15:48:38.818800+00:00 app[web.1]: at Module._compile (module.js:456:26)
2014-08-18T15:48:38.818802+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2014-08-18T15:48:38.818803+00:00 app[web.1]: at Module.load (module.js:356:32)
2014-08-18T15:48:38.818804+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2014-08-18T15:48:38.818806+00:00 app[web.1]: at Function.Module.runMain (module.js:497:10)
2014-08-18T15:48:38.818808+00:00 app[web.1]: at startup (node.js:119:16)
2014-08-18T15:48:38.818809+00:00 app[web.1]: at node.js:906:3
If you're using express 4.x.x, you must require the middleware separately.
For example, if you are using express.bodyParser(), you will need to replace it by performing the following steps:
Run npm install body-parser --save
Add this require near the top of your page with your require statements: var bodyParser = require('body-parser');
Find in your app:
app.use(express.bodyParser());
app.use(express.urlencoded());
app.use(express.json());
Replace ALL with this ONE line: app.use(bodyParser());
You must then complete these steps for all the other middleware your application uses and is listed on connect's migration guide.

Resources