Heroku + Node.js (express) - Application Error - node.js

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".

Related

Heroku[router]: at=error code=H10 desc=”App crashed“ method=GET path=/favicon.ico”

I have a simple MERN APP, that works fine on localhost, but when I deploy it to Heroku I see a page with this error:
Application error An error occurred in the application and your page
could not be served. If you are the application owner, check your logs
for details. You can do this from the Heroku CLI with the command
heroku logs --tail
And the console is showing this: Failed to load resource: the server responded with a status of 503 (Service Unavailable)
An Image of that has also been attached!
And Heroku logs are also given below...
I'm new to MERN Dev, so can't really figure out what's the issue really is and Heroku logs are also not much of help, please help me!
Warning: heroku update available from 7.59.0 to 7.59.2.
2022-01-05T13:28:24.783142+00:00 app[web.1]:
2022-01-05T13:28:25.124488+00:00 app[web.1]: /app/node_modules/whatwg-url/lib/encoding.js:2
2022-01-05T13:28:25.124505+00:00 app[web.1]: const utf8Encoder = new TextEncoder();
2022-01-05T13:28:25.124505+00:00 app[web.1]: ^
2022-01-05T13:28:25.124506+00:00 app[web.1]:
2022-01-05T13:28:25.124507+00:00 app[web.1]: ReferenceError: TextEncoder is not defined
2022-01-05T13:28:25.124507+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/encoding.js:2:21)
2022-01-05T13:28:25.124508+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T13:28:25.124508+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2022-01-05T13:28:25.124509+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2022-01-05T13:28:25.124510+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2022-01-05T13:28:25.124511+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
2022-01-05T13:28:25.124511+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T13:28:25.129285+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-05T13:28:25.129543+00:00 app[web.1]: npm ERR! errno 1
2022-01-05T13:28:25.130631+00:00 app[web.1]: npm ERR! server#1.0.0 start: `node server.js`
2022-01-05T13:28:25.130632+00:00 app[web.1]: npm ERR! Exit status 1
2022-01-05T13:28:25.130787+00:00 app[web.1]: npm ERR!
2022-01-05T13:28:25.130867+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2022-01-05T13:28:25.130870+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-05T13:28:25.135681+00:00 app[web.1]:
2022-01-05T13:28:25.135782+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-05T13:28:25.135828+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-05T13_28_25_131Z-debug.log
2022-01-05T13:28:25.273876+00:00 heroku[web.1]: Process exited with status 1
2022-01-05T13:28:25.334794+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-05T14:58:18.000000+00:00 app[api]: Build started by user sauviksood#gmail.com
2022-01-05T14:59:12.408461+00:00 app[api]: Deploy 278ece53 by user sauviksood#gmail.com
2022-01-05T14:59:12.408461+00:00 app[api]: Release v6 created by user sauviksood#gmail.com
2022-01-05T14:59:13.000000+00:00 app[api]: Build succeeded
2022-01-05T14:59:13.762177+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-05T14:59:19.381206+00:00 heroku[web.1]: Starting process with command `npm start`
2022-01-05T14:59:21.141420+00:00 app[web.1]:
2022-01-05T14:59:21.141434+00:00 app[web.1]: > server#1.0.0 start /app
2022-01-05T14:59:21.141435+00:00 app[web.1]: > node server.js
2022-01-05T14:59:21.141435+00:00 app[web.1]:
2022-01-05T14:59:21.365509+00:00 app[web.1]: /app/node_modules/whatwg-url/lib/encoding.js:2
2022-01-05T14:59:21.365511+00:00 app[web.1]: const utf8Encoder = new TextEncoder();
2022-01-05T14:59:21.365511+00:00 app[web.1]: ^
2022-01-05T14:59:21.365512+00:00 app[web.1]:
2022-01-05T14:59:21.365512+00:00 app[web.1]: ReferenceError: TextEncoder is not defined
2022-01-05T14:59:21.365512+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/encoding.js:2:21)
2022-01-05T14:59:21.365513+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:21.365513+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2022-01-05T14:59:21.365514+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2022-01-05T14:59:21.365515+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2022-01-05T14:59:21.365516+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
2022-01-05T14:59:21.365518+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:21.370906+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-05T14:59:21.371167+00:00 app[web.1]: npm ERR! errno 1
2022-01-05T14:59:21.371985+00:00 app[web.1]: npm ERR! server#1.0.0 start: `node server.js`
2022-01-05T14:59:21.372041+00:00 app[web.1]: npm ERR! Exit status 1
2022-01-05T14:59:21.372158+00:00 app[web.1]: npm ERR!
2022-01-05T14:59:21.372219+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2022-01-05T14:59:21.372273+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-05T14:59:21.375303+00:00 app[web.1]:
2022-01-05T14:59:21.375391+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-05T14:59:21.375436+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-05T14_59_21_373Z-debug.log
2022-01-05T14:59:21.529167+00:00 heroku[web.1]: Process exited with status 1
2022-01-05T14:59:21.611061+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-05T14:59:21.635160+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-05T14:59:28.249204+00:00 heroku[web.1]: Starting process with command `npm start`
2022-01-05T14:59:29.604172+00:00 app[web.1]:
2022-01-05T14:59:29.604192+00:00 app[web.1]: > server#1.0.0 start /app
2022-01-05T14:59:29.604193+00:00 app[web.1]: > node server.js
2022-01-05T14:59:29.604193+00:00 app[web.1]:
2022-01-05T14:59:29.864349+00:00 app[web.1]: /app/node_modules/whatwg-url/lib/encoding.js:2
2022-01-05T14:59:29.864368+00:00 app[web.1]: const utf8Encoder = new TextEncoder();
2022-01-05T14:59:29.864369+00:00 app[web.1]: ^
2022-01-05T14:59:29.864369+00:00 app[web.1]:
2022-01-05T14:59:29.864370+00:00 app[web.1]: ReferenceError: TextEncoder is not defined
2022-01-05T14:59:29.864370+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/encoding.js:2:21)
2022-01-05T14:59:29.864370+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2022-01-05T14:59:29.864371+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2022-01-05T14:59:29.864372+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2022-01-05T14:59:29.864372+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2022-01-05T14:59:29.864373+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
2022-01-05T14:59:29.864373+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2022-01-05T14:59:29.870542+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-05T14:59:29.870848+00:00 app[web.1]: npm ERR! errno 1
2022-01-05T14:59:29.871728+00:00 app[web.1]: npm ERR! server#1.0.0 start: `node server.js`
2022-01-05T14:59:29.871798+00:00 app[web.1]: npm ERR! Exit status 1
2022-01-05T14:59:29.871921+00:00 app[web.1]: npm ERR!
2022-01-05T14:59:29.871982+00:00 app[web.1]: npm ERR! Failed at the server#1.0.0 start script.
2022-01-05T14:59:29.872035+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-01-05T14:59:29.875332+00:00 app[web.1]:
2022-01-05T14:59:29.875429+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-05T14:59:29.875474+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-05T14_59_29_872Z-debug.log
2022-01-05T14:59:30.008365+00:00 heroku[web.1]: Process exited with status 1
2022-01-05T14:59:30.061904+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-05T14:59:31.128259+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=movie-watchlist-mern.herokuapp.com request_id=f86c07e6-1ee6-42c9-88be-3c7d1a60e53d fwd="103.155.240.47" dyno= connect= service= status=503 bytes= protocol=https
2022-01-05T14:59:34.147698+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=movie-watchlist-mern.herokuapp.com request_id=c0ccd4db-98b3-40fa-90c1-ad33cfe5a065 fwd="103.155.240.47" dyno= connect= service= status=503 bytes= protocol=https
Your heroku setup needs an update to the version 7.59.2
For this:
You have to run npm command if npm used for the heroku cli installation in you device,
npm:
npm upgrade -g heroku
Or if heroku was installed with yarn then,
yarn:
yarn global upgrade heroku
This may help your issue

Heroku deployment with node.js and postgresql api not working

I have been recently been working on a node.js api with a postgresql database that stores books.
When you go to the route /books it gives me the heroku application error page (here is the api https://node-api-with-books.herokuapp.com/books) and I followed this tutorial to make it https://www.taniarascia.com/node-express-postgresql-heroku/. It is driving me crazy and here is the error it gives when I do:
heroku logs --tail
2021-03-15T04:04:21.094893+00:00 app[web.1]: /app/index.js:12
2021-03-15T04:04:21.094902+00:00 app[web.1]: throw err;
2021-03-15T04:04:21.094903+00:00 app[web.1]: ^
2021-03-15T04:04:21.094904+00:00 app[web.1]:
2021-03-15T04:04:21.094904+00:00 app[web.1]: Error: self signed certificate
2021-03-15T04:04:21.094905+00:00 app[web.1]: at TLSSocket.onConnectSecure (node:_tls_wrap:1498:34)
2021-03-15T04:04:21.094906+00:00 app[web.1]: at TLSSocket.emit (node:events:327:20)
2021-03-15T04:04:21.094906+00:00 app[web.1]: at TLSSocket._finishInit (node:_tls_wrap:933:8)
2021-03-15T04:04:21.094907+00:00 app[web.1]: at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:707:12) {
2021-03-15T04:04:21.094907+00:00 app[web.1]: code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
2021-03-15T04:04:21.094907+00:00 app[web.1]: }
2021-03-15T04:04:21.099759+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=5ec4a052-1aed-4401-916d-1699f1fe9d3d fwd="66.7.125.54" dyno=web.1 connect=0ms service=50ms status=503 bytes=0 protocol=https
2021-03-15T04:04:21.100313+00:00 app[web.1]: npm notice
2021-03-15T04:04:21.100365+00:00 app[web.1]: npm notice New minor version of npm available! 7.0.8 -> 7.6.3
2021-03-15T04:04:21.100444+00:00 app[web.1]: npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.6.3>
2021-03-15T04:04:21.100541+00:00 app[web.1]: npm notice Run `npm install -g npm#7.6.3` to update!
2021-03-15T04:04:21.100619+00:00 app[web.1]: npm notice
2021-03-15T04:04:21.104741+00:00 app[web.1]: npm ERR! code 1
2021-03-15T04:04:21.104926+00:00 app[web.1]: npm ERR! path /app
2021-03-15T04:04:21.108208+00:00 app[web.1]: npm ERR! command failed
2021-03-15T04:04:21.108390+00:00 app[web.1]: npm ERR! command sh -c node index.js
2021-03-15T04:04:21.353877+00:00 app[web.1]:
2021-03-15T04:04:21.354099+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-15T04:04:21.354257+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-15T04_04_21_109Z-debug.log
2021-03-15T04:04:21.413929+00:00 heroku[web.1]: Process exited with status 1
2021-03-15T04:04:21.490613+00:00 heroku[web.1]: State changed from up to crashed
2021-03-15T04:04:21.495328+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-15T04:04:24.629509+00:00 heroku[web.1]: Starting process with command `npm start`
2021-03-15T04:04:27.698683+00:00 app[web.1]:
2021-03-15T04:04:27.698698+00:00 app[web.1]: > working-rest-api#1.0.0 start
2021-03-15T04:04:27.698698+00:00 app[web.1]: > node index.js
2021-03-15T04:04:27.698698+00:00 app[web.1]:
2021-03-15T04:04:28.035756+00:00 app[web.1]: Server listening
2021-03-15T04:04:28.553149+00:00 heroku[web.1]: State changed from starting to up
2021-03-15T04:04:29.332623+00:00 app[web.1]: /app/index.js:12
2021-03-15T04:04:29.332639+00:00 app[web.1]: throw err;
2021-03-15T04:04:29.332640+00:00 app[web.1]: ^
2021-03-15T04:04:29.332641+00:00 app[web.1]:
2021-03-15T04:04:29.332641+00:00 app[web.1]: Error: self signed certificate
2021-03-15T04:04:29.332642+00:00 app[web.1]: at TLSSocket.onConnectSecure (node:_tls_wrap:1498:34)
2021-03-15T04:04:29.332643+00:00 app[web.1]: at TLSSocket.emit (node:events:327:20)
2021-03-15T04:04:29.332643+00:00 app[web.1]: at TLSSocket._finishInit (node:_tls_wrap:933:8)
2021-03-15T04:04:29.332643+00:00 app[web.1]: at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:707:12) {
2021-03-15T04:04:29.332644+00:00 app[web.1]: code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
2021-03-15T04:04:29.332644+00:00 app[web.1]: }
2021-03-15T04:04:29.340112+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=8af9f82c-42c9-4399-9de3-ed80f7dee15a fwd="66.7.125.54" dyno=web.1 connect=1ms service=74ms status=503 bytes=0 protocol=https
2021-03-15T04:04:29.343368+00:00 app[web.1]: npm notice
2021-03-15T04:04:29.343566+00:00 app[web.1]: npm notice New minor version of npm available! 7.0.8 -> 7.6.3
2021-03-15T04:04:29.343688+00:00 app[web.1]: npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.6.3>
2021-03-15T04:04:29.343859+00:00 app[web.1]: npm notice Run `npm install -g npm#7.6.3` to update!
2021-03-15T04:04:29.344058+00:00 app[web.1]: npm notice
2021-03-15T04:04:29.348863+00:00 app[web.1]: npm ERR! code 1
2021-03-15T04:04:29.349087+00:00 app[web.1]: npm ERR! path /app
2021-03-15T04:04:29.352585+00:00 app[web.1]: npm ERR! command failed
2021-03-15T04:04:29.352766+00:00 app[web.1]: npm ERR! command sh -c node index.js
2021-03-15T04:04:29.364318+00:00 app[web.1]:
2021-03-15T04:04:29.364464+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-15T04:04:29.364515+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-15T04_04_29_354Z-debug.log
2021-03-15T04:04:29.443525+00:00 heroku[web.1]: Process exited with status 1
2021-03-15T04:04:29.510747+00:00 heroku[web.1]: State changed from up to crashed
I can add you on heroku if you have a idea
Here is my code on github https://github.com/PugmanD/gticlicker-api-and-book-api/tree/main
Any help is appreciated
After trying with the uploaded repo. I've confirmed the error lies at the following place
config.js
const pool = new Pool({
connectionString: isProduction ? process.env.DATABASE_URL : connectionString,
ssl: isProduction, // The problem is this setting
});
Update your config.js to following
const pool = new Pool({
connectionString: isProduction ? process.env.DATABASE_URL : connectionString,
ssl: {
rejectUnauthorized: false,
},
});
node-postgres did show how to setup the SSL in their documentation
https://node-postgres.com/features/ssl
The problem why u faced this is most likely that the node-postgres couldn't find your SSL cert, hence the error.
This is the heroku link that I've make it working, I will remove the project in a few days. Feel free to try it.
https://test-postgresl.herokuapp.com/books

Unable to push MERN App to heroku servers

So I have this MERN app pushed to my github repo https://github.com/Banialczele/coursemanagement and now I would like to push that repo to heroku.
My problem is that when ever I try to deploy my app to heroku server it deploys to server, but when I want to visit that link I got an error. However when I try to run heroku local web in my IDE my app runs perfectly, but when I want to deploy to server something is crushing all the time. This is what stacktrace looks like:
2020-03-14T12:25:20.748376+00:00 app[web.1]: [1] Error: Cannot find module 'express'
2020-03-14T12:25:20.748376+00:00 app[web.1]: [1] Require stack:
2020-03-14T12:25:20.748376+00:00 app[web.1]: [1] - /app/server/src/index.js
2020-03-14T12:25:20.748378+00:00 app[web.1]: [1] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
2020-03-14T12:25:20.748379+00:00 app[web.1]: [1] at Function.Module._load (internal/modules/cjs/loader.js:864:27)
2020-03-14T12:25:20.748379+00:00 app[web.1]: [1] at Module.require (internal/modules/cjs/loader.js:1044:19)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at require (internal/modules/cjs/helpers.js:77:18)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at Object.<anonymous> (/app/server/src/index.js:1:17)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at Module._compile (internal/modules/cjs/loader.js:1158:30)
2020-03-14T12:25:20.748380+00:00 app[web.1]: [1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] at Module.load (internal/modules/cjs/loader.js:1002:32)
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] at Function.Module._load (internal/modules/cjs/loader.js:901:14)
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
2020-03-14T12:25:20.748381+00:00 app[web.1]: [1] code: 'MODULE_NOT_FOUND',
2020-03-14T12:25:20.748382+00:00 app[web.1]: [1] requireStack: [ '/app/server/src/index.js' ]
2020-03-14T12:25:20.748382+00:00 app[web.1]: [1] }
2020-03-14T12:25:20.756503+00:00 app[web.1]: [1] npm ERR! code ELIFECYCLE
2020-03-14T12:25:20.756505+00:00 app[web.1]: [1] npm ERR! errno 1
2020-03-14T12:25:20.759707+00:00 app[web.1]: [1] npm ERR! teachercourseapp#1.0.0 server: `cd server/src && node index.js`
2020-03-14T12:25:20.760641+00:00 app[web.1]: [1] npm ERR! Exit status 1
2020-03-14T12:25:20.760642+00:00 app[web.1]: [1] npm ERR!
2020-03-14T12:25:20.760643+00:00 app[web.1]: [1] npm ERR! Failed at the teachercourseapp#1.0.0 server script.
2020-03-14T12:25:20.760644+00:00 app[web.1]: [1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:20.769172+00:00 app[web.1]: [1]
2020-03-14T12:25:20.771168+00:00 app[web.1]: [1] npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:20.771169+00:00 app[web.1]: [1] npm ERR! /app/.npm/_logs/2020-03-14T12_25_20_761Z-debug.log
2020-03-14T12:25:20.779534+00:00 app[web.1]: [1] npm run server exited with code 1
2020-03-14T12:25:21.019553+00:00 app[web.1]: [0]
2020-03-14T12:25:21.019562+00:00 app[web.1]: [0] > coursemanagement#0.1.0 start /app/client
2020-03-14T12:25:21.019563+00:00 app[web.1]: [0] > react-scripts start
2020-03-14T12:25:21.019563+00:00 app[web.1]: [0]
2020-03-14T12:25:21.024669+00:00 app[web.1]: [0] sh: 1: react-scripts: not found
2020-03-14T12:25:21.029965+00:00 app[web.1]: [0] npm ERR! code ELIFECYCLE
2020-03-14T12:25:21.029966+00:00 app[web.1]: [0] npm ERR! syscall spawn
2020-03-14T12:25:21.030363+00:00 app[web.1]: npm ERR! file sh
2020-03-14T12:25:21.030364+00:00 app[web.1]: [0] npm ERR! errno ENOENT
2020-03-14T12:25:21.031948+00:00 app[web.1]: [0] npm ERR! coursemanagement#0.1.0 start: `react-scripts start`
2020-03-14T12:25:21.031949+00:00 app[web.1]: [0] npm ERR! spawn ENOENT
2020-03-14T12:25:21.031949+00:00 app[web.1]: [0] npm ERR!
2020-03-14T12:25:21.033375+00:00 app[web.1]: npm ERR! Failed at the coursemanagement#0.1.0 start script.
2020-03-14T12:25:21.033376+00:00 app[web.1]: [0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:21.037820+00:00 app[web.1]: [0] npm WARN Local package.json exists, but node_modules missing, did you mean to install?
2020-03-14T12:25:21.038198+00:00 app[web.1]: [0]
2020-03-14T12:25:21.038591+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:21.038592+00:00 app[web.1]: [0] npm ERR! /app/.npm/_logs/2020-03-14T12_25_21_032Z-debug.log
2020-03-14T12:25:21.047517+00:00 app[web.1]: [0] npm ERR! code ELIFECYCLE
2020-03-14T12:25:21.047518+00:00 app[web.1]: [0] npm ERR! errno 1
2020-03-14T12:25:21.048896+00:00 app[web.1]: [0] npm ERR! teachercourseapp#1.0.0 client: `cd client/src && npm start`
2020-03-14T12:25:21.048897+00:00 app[web.1]: [0] npm ERR! Exit status 1
2020-03-14T12:25:21.048897+00:00 app[web.1]: [0] npm ERR!
2020-03-14T12:25:21.049322+00:00 app[web.1]: npm ERR! Failed at the teachercourseapp#1.0.0 client script.
2020-03-14T12:25:21.049753+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:21.055102+00:00 app[web.1]: [0]
2020-03-14T12:25:21.055708+00:00 app[web.1]: [0] npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:21.055709+00:00 app[web.1]: [0] npm ERR! /app/.npm/_logs/2020-03-14T12_25_21_050Z-debug.log
2020-03-14T12:25:21.060294+00:00 app[web.1]: [0] npm run client exited with code 1
2020-03-14T12:25:21.067946+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-03-14T12:25:21.068281+00:00 app[web.1]: npm ERR! errno 1
2020-03-14T12:25:21.069285+00:00 app[web.1]: npm ERR! teachercourseapp#1.0.0 start: `concurrently "npm run client" "npm run server" `
2020-03-14T12:25:21.069440+00:00 app[web.1]: npm ERR! Exit status 1
2020-03-14T12:25:21.069684+00:00 app[web.1]: npm ERR!
2020-03-14T12:25:21.069864+00:00 app[web.1]: npm ERR! Failed at the teachercourseapp#1.0.0 start script.
2020-03-14T12:25:21.070045+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-03-14T12:25:21.075605+00:00 app[web.1]:
2020-03-14T12:25:21.075900+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-03-14T12:25:21.076095+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-03-14T12_25_21_070Z-debug.log
2020-03-14T12:25:21.194915+00:00 heroku[web.1]: State changed from starting to crashed
2020-03-14T12:25:21.175761+00:00 heroku[web.1]: Process exited with status 1
2020-03-14T12:25:22.079114+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=managingcourses.herokuapp.com request_id=175c1aa8-0966-4493-a328-ed303e4b8075 fwd="188.123.215.228
" dyno= connect= service= status=503 bytes= protocol=https
2020-03-14T12:25:22.577434+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=managingcourses.herokuapp.com request_id=912f071c-c6c0-49ce-996d-33005e324fb1 fwd="188.
123.215.228" dyno= connect= service= status=503 bytes= protocol=https
It starts with cannot find express module, but I've reinstalled it with --save flag and nothing changes. Could you please help me try to figure this out? I'm stack for like 2 days with that error.
Following the comment, I post where the problem is:
Heroku is looking at the package.json located at the root of your project. You installed express in the server folder but the file at the root does not contain it.
Either you can push a subtree of your repository:
git subtree push --prefix path/to/subdirectory heroku master
Or just split up your server and client parts into two repositories.

NodeJS Heroku Deploying Error

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.

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