I am trying to deploy a MERN app to Heroku and this is my error log and package.json file. Can anyone see what might be causing this? I am having trouble making sense of the logs.
2020-08-18T19:02:01.418730+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start:dev script.
2020-08-18T19:02:01.418905+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:01.460333+00:00 app[web.1]:
2020-08-18T19:02:01.465165+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:01.465345+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_01_448Z-debug.log
2020-08-18T19:02:01.513257+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:01.513666+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:01.518773+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2020-08-18T19:02:01.518992+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:01.519232+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:01.519442+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start script.
2020-08-18T19:02:01.519639+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:01.548584+00:00 app[web.1]:
2020-08-18T19:02:01.548885+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:01.549093+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_01_529Z-debug.log
2020-08-18T19:02:01.616487+00:00 heroku[web.1]: Process exited with status 1
2020-08-18T19:02:01.665085+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-18T19:02:01.668346+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-18T19:02:12.552667+00:00 heroku[web.1]: Starting process with command `npm start`
2020-08-18T19:02:15.353294+00:00 app[web.1]:
2020-08-18T19:02:15.353325+00:00 app[web.1]: > mern-test#1.0.0 start /app
2020-08-18T19:02:15.353326+00:00 app[web.1]: > if-env NODE_ENV=production && npm run start:prod || npm run start:dev
2020-08-18T19:02:15.353326+00:00 app[web.1]:
2020-08-18T19:02:15.968345+00:00 app[web.1]:
2020-08-18T19:02:15.968361+00:00 app[web.1]: > mern-test#1.0.0 start:prod /app
2020-08-18T19:02:15.968361+00:00 app[web.1]: > node server.js
2020-08-18T19:02:15.968362+00:00 app[web.1]:
2020-08-18T19:02:16.998859+00:00 app[web.1]: internal/modules/cjs/loader.js:968
2020-08-18T19:02:16.998874+00:00 app[web.1]: throw err;
2020-08-18T19:02:16.998875+00:00 app[web.1]: ^
2020-08-18T19:02:16.998875+00:00 app[web.1]:
2020-08-18T19:02:16.998876+00:00 app[web.1]: Error: Cannot find module '../../controllers/theAudioDbController'
2020-08-18T19:02:16.998876+00:00 app[web.1]: Require stack:
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/routes/api/index.js
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/routes/index.js
2020-08-18T19:02:16.998877+00:00 app[web.1]: - /app/server.js
2020-08-18T19:02:16.998878+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
2020-08-18T19:02:16.998878+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:841:27)
2020-08-18T19:02:16.998879+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-08-18T19:02:16.998879+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Object.<anonymous> (/app/routes/api/index.js:2:30)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-08-18T19:02:16.998880+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14)
2020-08-18T19:02:16.998881+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-08-18T19:02:16.998882+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-08-18T19:02:16.998882+00:00 app[web.1]: at Object.<anonymous> (/app/routes/index.js:3:19)
2020-08-18T19:02:16.998883+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-08-18T19:02:16.998883+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-08-18T19:02:16.998884+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-08-18T19:02:16.998923+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14) {
2020-08-18T19:02:16.998924+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-08-18T19:02:16.998925+00:00 app[web.1]: requireStack: [
2020-08-18T19:02:16.998925+00:00 app[web.1]: '/app/routes/api/index.js',
2020-08-18T19:02:16.998925+00:00 app[web.1]: '/app/routes/index.js',
2020-08-18T19:02:16.998926+00:00 app[web.1]: '/app/server.js'
2020-08-18T19:02:16.998926+00:00 app[web.1]: ]
2020-08-18T19:02:16.998927+00:00 app[web.1]: }
2020-08-18T19:02:17.021432+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.021861+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:17.025837+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start:prod: `node server.js`
2020-08-18T19:02:17.026037+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:17.026255+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.026335+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start:prod script.
2020-08-18T19:02:17.026396+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.033129+00:00 app[web.1]:
2020-08-18T19:02:17.033396+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.033590+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_17_028Z-debug.log
2020-08-18T19:02:17.588460+00:00 app[web.1]:
2020-08-18T19:02:17.588474+00:00 app[web.1]: > mern-test#1.0.0 start:dev /app
2020-08-18T19:02:17.588475+00:00 app[web.1]: > concurrently "nodemon --ignore 'client/*'" "npm run client"
2020-08-18T19:02:17.588476+00:00 app[web.1]:
2020-08-18T19:02:17.597996+00:00 app[web.1]: sh: 1: concurrently: not found
2020-08-18T19:02:17.617437+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.618167+00:00 app[web.1]: npm ERR! syscall spawn
2020-08-18T19:02:17.618426+00:00 app[web.1]: npm ERR! file sh
2020-08-18T19:02:17.618677+00:00 app[web.1]: npm ERR! errno ENOENT
2020-08-18T19:02:17.623336+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start:dev: `concurrently "nodemon --ignore 'client/*'" "npm run client"`
2020-08-18T19:02:17.623493+00:00 app[web.1]: npm ERR! spawn ENOENT
2020-08-18T19:02:17.623658+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.623829+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start:dev script.
2020-08-18T19:02:17.623976+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.630596+00:00 app[web.1]:
2020-08-18T19:02:17.630799+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.630952+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_17_626Z-debug.log
2020-08-18T19:02:17.657848+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-18T19:02:17.658272+00:00 app[web.1]: npm ERR! errno 1
2020-08-18T19:02:17.663230+00:00 app[web.1]: npm ERR! mern-test#1.0.0 start: `if-env NODE_ENV=production && npm run start:prod || npm run start:dev`
2020-08-18T19:02:17.663456+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-18T19:02:17.663695+00:00 app[web.1]: npm ERR!
2020-08-18T19:02:17.663882+00:00 app[web.1]: npm ERR! Failed at the mern-test#1.0.0 start script.
2020-08-18T19:02:17.664063+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-18T19:02:17.671333+00:00 app[web.1]:
2020-08-18T19:02:17.671650+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-18T19:02:17.671850+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-18T19_02_17_666Z-debug.log
2020-08-18T19:02:17.746107+00:00 heroku[web.1]: Process exited with status 1
2020-08-18T19:02:17.785792+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-18T19:02:20.046326+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=merntest.herokuapp.com request_id=ac795fc0-7677-4528-8f27-2f05a5f81912 fwd="99.9.203.7" dyno= connect= service= status=503 bytes= protocol=https
2020-08-18T19:02:21.701159+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=merntest.herokuapp.com request_id=288cf6cd-cff6-4943-9a89-b51bd0e8b8af fwd="99.9.203.7" dyno= connect= service= status=503 bytes= protocol=https
Here is my package.json file:
{
"name": "mern-test",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
"start:prod": "node server.js",
"start:dev": "concurrently \"nodemon --ignore 'client/*'\" \"npm run client\"",
"client": "cd client && npm run start",
"install": "cd client && npm install",
"build": "cd client && npm run build",
"heroku-postbuild": "npm run install && npm run build "
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.19.2",
"bcryptjs": "^2.4.3",
"express": "^4.17.1",
"express-session": "^1.17.1",
"if-env": "^1.0.4",
"moment": "^2.27.0",
"mongoose": "^5.9.25",
"morgan": "^1.10.0",
"passport": "^0.4.1",
"passport-local": "^1.0.0",
"path": "^0.12.7",
"react-datepicker": "^3.1.3",
"react-router-dom": "^5.2.0",
"react-star-ratings": "^2.3.0",
"router": "^1.3.5"
},
"devDependencies": {
"concurrently": "^4.1.0",
"nodemon": "^2.0.4"
}
}
Please let me know if you see anything that is obviously wrong, or how I might continue to troubleshoot this. I am unsure of where to even start. Thank you.
As the Error says Error: Cannot find module '../../controllers/theAudioDbController'. Check if the file name is correct.
Related
App works fine in my dev environment, deploys, but I keep getting an application error.
app[web.1]: npm ERR! Exit status 1
app[web.1]: npm ERR!
app[web.1]: npm ERR! Failed at the picklists#1.0.0 start script.
app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
app[web.1]:
app[web.1]: npm ERR! A complete log of this run can be found in:
app[web.1]: npm ERR! /app/.npm/_logs/2021-03-08T16_18_11_394Z-debug.log
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `npm start`
app[web.1]:
app[web.1]: > picklists#1.0.0 start /app
app[web.1]: > node server.js
app[web.1]:
app[web.1]: WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
app[web.1]: WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
app[web.1]: WARNING: No configurations found in configuration directory:/app/config
app[web.1]: WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
app[web.1]: /app/node_modules/config/lib/config.js:182
app[web.1]: throw new Error('Configuration property "' + property + '" is not defined');
app[web.1]: ^
app[web.1]:
app[web.1]: Error: Configuration property "mongoURI" is not defined
app[web.1]: at Config.get (/app/node_modules/config/lib/config.js:182:11)
app[web.1]: at Object.<anonymous> (/app/config/db.js:3:19)
app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
app[web.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
app[web.1]: at Module.require (internal/modules/cjs/loader.js:903:19)
app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
app[web.1]: at Object.<anonymous> (/app/server.js:2:19)
app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
app[web.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
app[web.1]: at internal/main/run_main_module.js:17:47
app[web.1]: npm ERR! code ELIFECYCLE
app[web.1]: npm ERR! errno 1
app[web.1]: npm ERR! picklists#1.0.0 start: `node server.js`
app[web.1]: npm ERR! Exit status 1
app[web.1]: npm ERR!
app[web.1]: npm ERR! Failed at the picklists#1.0.0 start script.
app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
app[web.1]:
app[web.1]: npm ERR! A complete log of this run can be found in:
app[web.1]: npm ERR! /app/.npm/_logs/2021-03-08T16_18_25_458Z-debug.log
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
app[api]: Release v18 created by user
app[api]: Deploy 1d38210b by user
app[api]: Build succeeded
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `npm start`
[web.1]:
[web.1]: > picklists#1.0.0 start /app
app[web.1]: > node server.js
app[web.1]:
app[web.1]: WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
app[web.1]: WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
app[web.1]: WARNING: No configurations found in configuration directory:/app/config
app[web.1]: WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
app[web.1]: /app/node_modules/config/lib/config.js:182
app[web.1]: throw new Error('Configuration property "' + property + '" is not defined');
app[web.1]: ^
app[web.1]:
app[web.1]: Error: Configuration property "MONGO_URI" is not defined
app[web.1]: at Config.get (/app/node_modules/config/lib/config.js:182:11)
app[web.1]: at Object.<anonymous> (/app/config/db.js:3:19)
app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
app[web.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
app[web.1]: at Module.require (internal/modules/cjs/loader.js:903:19)
app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
app[web.1]: at Object.<anonymous> (/app/server.js:2:19)
app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
app[web.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
app[web.1]: at internal/main/run_main_module.js:17:47
app[web.1]: npm ERR! code ELIFECYCLE
app[web.1]: npm ERR! errno 1
app[web.1]: npm ERR! picklists#1.0.0 start: `node server.js`
app[web.1]: npm ERR! Exit status 1
app[web.1]: npm ERR!
app[web.1]: npm ERR! Failed at the picklists#1.0.0 start script.
app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
app[web.1]:
app[web.1]: npm ERR! A complete log of this run can be found in:
app[web.1]: npm ERR! /app/.npm/_logs/2021-03-08T16_18_53_202Z-debug.log
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=picklists.herokuapp.com status=503 bytes= protocol=https
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=picklists.herokuapp.com status=503 bytes= protocol=https
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=picklists.herokuapp.com status=503 bytes= protocol=https
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=picklists.herokuapp.com status=503 bytes= protocol=https
I've tried to reset the dependencies on client and server
npm cache clean --force
rm -rf node_modules package-lock.json
npm install
I've added a Procfile
web:npm start
I'm using an env var for the PORT
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
console.log(`Server started on port ${PORT}`);
});
This is the package.json
{
"name": "picklists",
"version": "1.0.0",
"engines": {
"node": "12.x"
},
"description": "A MERN app that creates inventory picklists for backstock retrieval",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"clientinstall": "npm install --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"repository": {
"type": "git",
"url": "git+https://github.com/louiswhisenant/picklists.git"
},
"author": "Louis Whisenant",
"license": "ISC",
"bugs": {
"url": "https://github.com/louiswhisenant/picklists/issues"
},
"homepage": "https://github.com/louiswhisenant/picklists#readme",
"dependencies": {
"bcryptjs": "^2.4.3",
"config": "^3.3.4",
"express": "^4.17.1",
"express-validator": "^6.10.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.11.19"
},
"devDependencies": {
"concurrently": "^5.3.0",
"nodemon": "^2.0.7"
}
}
Env vars are set on heroku. I'm deploying from github instead of the heroku CLI, if that makes any difference.
Also, if references the full debug log at '/app/.npm/_logs/2021-03-08T16_18_11_394Z-debug.log', but I wasn't sure exactly how/where to access that log and see what it says. Can I do it from the terminal, or is it on Heroku?
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.
Trying to deploy a MERN stack app in Heroku and in the logs it mentions not finding Babel and a module './common'
I've already ran npm install before trying to deploy, I've removed all version 6 instances of Babel to upgrade to version 7 and I've reconfigured the build script as well to no avail.
Package.json - scripts:
"scripts": {
"start": "npm run build && node dist/index.js",
"serve": "node dist/index.js",
"build": "babel ./src/index.js -d dist",
"heroku-postbuild": "cd front-end && npm install --only=dev && npm install && npm run build"
},
Package.json - dependencies:
"dependencies": {
"#babel/cli": "^7.6.0",
"#babel/core": "^7.6.0",
"#babel/preset-env": "^7.6.0",
"#babel/register": "^7.6.0",
"#elastic/elasticsearch": "^7.2.0",
"aws-sdk": "^2.518.0",
"aws4": "^1.8.0",
"axios": "^0.19.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"cheerio": "^1.0.0-rc.3",
"common": "^0.2.5",
"connect-mongo": "^2.0.2",
"cookie-parser": "^1.4.3",
"cors": "^2.8.4",
"dotenv": "^7.0.0",
"elasticsearch": "^16.3.0",
"express": "^4.16.3",
"express-session": "^1.15.6",
"express-validator": "^5.3.1",
"helmet": "^3.18.0",
"http-aws-es": "^6.0.0",
"install": "^0.13.0",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.11",
"mongoosastic": "^4.5.0",
"mongoose": "^5.3.4",
"morgan": "^1.9.1",
"multer": "^1.4.1",
"node-mailjet": "^3.3.1",
"node-pre-gyp": "^0.13.0",
"passport": "^0.4.0",
"passport-custom": "^1.0.5",
"passport-jwt": "^4.0.0",
"passport.socketio": "^3.7.0",
"request": "^2.88.0",
"request-promise": "^4.2.4",
"socket.io": "^2.2.0",
"socket.io-redis": "^5.2.0",
"stripe": "^6.25.1",
"swagger": "^0.7.5",
"swagger-ui-express": "^4.0.2",
"sync-request": "^6.1.0",
"validator": "^10.8.0",
"winston": "^3.1.0",
"xss": "^1.0.3"
},
"devDependencies": {
"nodemon": "^1.18.4"
}
Heroku Logs:
› Warning: heroku update available from 7.26.2 to 7.29.0.
2019-09-06T21:25:37.376275+00:00 app[web.1]: > paymentPlatform#0.3.0 build /app
2019-09-06T21:25:37.376282+00:00 app[web.1]: > babel ./src/index.js -d dist
2019-09-06T21:25:37.376284+00:00 app[web.1]:
2019-09-06T21:25:37.397001+00:00 app[web.1]: sh: 1: babel: not found
2019-09-06T21:25:37.404228+00:00 app[web.1]: npm ERR! file sh
2019-09-06T21:25:37.404233+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:25:37.404235+00:00 app[web.1]: npm ERR! errno ENOENT
2019-09-06T21:25:37.404238+00:00 app[web.1]: npm ERR! syscall spawn
2019-09-06T21:25:37.404242+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 build: `babel ./src/index.js -d dist`
2019-09-06T21:25:37.404244+00:00 app[web.1]: npm ERR! spawn ENOENT
2019-09-06T21:25:37.404247+00:00 app[web.1]: npm ERR!
2019-09-06T21:25:37.407890+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 build script.
2019-09-06T21:25:37.408099+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:25:37.418872+00:00 app[web.1]:
2019-09-06T21:25:37.419240+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:25:37.419654+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_25_37_410Z-debug.log
2019-09-06T21:25:37.439598+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:25:37.439920+00:00 app[web.1]: npm ERR! errno 1
2019-09-06T21:25:37.441347+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 start: `npm run build && node dist/index.js`
2019-09-06T21:25:37.441475+00:00 app[web.1]: npm ERR! Exit status 1
2019-09-06T21:25:37.441652+00:00 app[web.1]: npm ERR!
2019-09-06T21:25:37.441800+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 start script.
2019-09-06T21:25:37.441910+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:25:37.452916+00:00 app[web.1]:
2019-09-06T21:25:37.453949+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:25:37.455068+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_25_37_443Z-debug.log
2019-09-06T21:25:37.550220+00:00 heroku[web.1]: State changed from starting to crashed
2019-09-06T21:25:37.516263+00:00 heroku[web.1]: Process exited with status 1
2019-09-06T21:27:38.000000+00:00 app[api]: Build started by user ****.****#****.com
2019-09-06T21:31:22.176037+00:00 heroku[web.1]: State changed from crashed to starting
2019-09-06T21:31:22.014875+00:00 app[api]: Deploy 4dff7a9b by user ****.****#****.com
2019-09-06T21:31:22.014875+00:00 app[api]: Release v21 created by user ****.****#****.com
2019-09-06T21:31:29.000000+00:00 app[api]: Build succeeded
2019-09-06T21:31:52.195501+00:00 heroku[web.1]: Starting process with command `npm start`
2019-09-06T21:31:54.048390+00:00 app[web.1]:
2019-09-06T21:31:54.048412+00:00 app[web.1]: > paymentPlatform#0.3.0 start /app
2019-09-06T21:31:54.048414+00:00 app[web.1]: > npm run build && node dist/index.js
2019-09-06T21:31:54.048416+00:00 app[web.1]:
2019-09-06T21:31:54.590422+00:00 heroku[web.1]: State changed from starting to crashed
2019-09-06T21:31:54.367485+00:00 app[web.1]:
2019-09-06T21:31:54.367522+00:00 app[web.1]: > paymentPlatform#0.3.0 build /app
2019-09-06T21:31:54.367532+00:00 app[web.1]: > babel ./src/index.js -d dist
2019-09-06T21:31:54.367534+00:00 app[web.1]:
2019-09-06T21:31:54.481962+00:00 app[web.1]: internal/modules/cjs/loader.js:628
2019-09-06T21:31:54.481965+00:00 app[web.1]: throw err;
2019-09-06T21:31:54.481966+00:00 app[web.1]: ^
2019-09-06T21:31:54.481968+00:00 app[web.1]:
2019-09-06T21:31:54.481970+00:00 app[web.1]: Error: Cannot find module './common'
2019-09-06T21:31:54.481971+00:00 app[web.1]: Require stack:
2019-09-06T21:31:54.481974+00:00 app[web.1]: - /app/node_modules/debug/src/node.js
2019-09-06T21:31:54.481975+00:00 app[web.1]: - /app/node_modules/debug/src/index.js
2019-09-06T21:31:54.481977+00:00 app[web.1]: - /app/node_modules/#babel/core/lib/config/files/configuration.js
2019-09-06T21:31:54.481978+00:00 app[web.1]: - /app/node_modules/#babel/core/lib/config/files/index.js
2019-09-06T21:31:54.481980+00:00 app[web.1]: - /app/node_modules/#babel/core/lib/index.js
2019-09-06T21:31:54.481981+00:00 app[web.1]: - /app/node_modules/#babel/cli/lib/babel/options.js
2019-09-06T21:31:54.481983+00:00 app[web.1]: - /app/node_modules/#babel/cli/lib/babel/index.js
2019-09-06T21:31:54.481984+00:00 app[web.1]: - /app/node_modules/#babel/cli/bin/babel.js
2019-09-06T21:31:54.481986+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
2019-09-06T21:31:54.481987+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:527:27)
2019-09-06T21:31:54.481989+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:683:19)
2019-09-06T21:31:54.481990+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:16:16)
2019-09-06T21:31:54.481992+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/debug/src/node.js:236:18)
2019-09-06T21:31:54.481994+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2019-09-06T21:31:54.481995+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2019-09-06T21:31:54.481997+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:643:32)
2019-09-06T21:31:54.481998+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:556:12)
2019-09-06T21:31:54.482000+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:683:19) {
2019-09-06T21:31:54.482001+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-09-06T21:31:54.482003+00:00 app[web.1]: requireStack: [
2019-09-06T21:31:54.482004+00:00 app[web.1]: '/app/node_modules/debug/src/node.js',
2019-09-06T21:31:54.482005+00:00 app[web.1]: '/app/node_modules/debug/src/index.js',
2019-09-06T21:31:54.482007+00:00 app[web.1]: '/app/node_modules/#babel/core/lib/config/files/configuration.js',
2019-09-06T21:31:54.482009+00:00 app[web.1]: '/app/node_modules/#babel/core/lib/config/files/index.js',
2019-09-06T21:31:54.482010+00:00 app[web.1]: '/app/node_modules/#babel/core/lib/index.js',
2019-09-06T21:31:54.482012+00:00 app[web.1]: '/app/node_modules/#babel/cli/lib/babel/options.js',
2019-09-06T21:31:54.482013+00:00 app[web.1]: '/app/node_modules/#babel/cli/lib/babel/index.js',
2019-09-06T21:31:54.482014+00:00 app[web.1]: '/app/node_modules/#babel/cli/bin/babel.js'
2019-09-06T21:31:54.482016+00:00 app[web.1]: ]
2019-09-06T21:31:54.482017+00:00 app[web.1]: }
2019-09-06T21:31:54.487548+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:31:54.487731+00:00 app[web.1]: npm ERR! errno 1
2019-09-06T21:31:54.488648+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 build: `babel ./src/index.js -d dist`
2019-09-06T21:31:54.488743+00:00 app[web.1]: npm ERR! Exit status 1
2019-09-06T21:31:54.488862+00:00 app[web.1]: npm ERR!
2019-09-06T21:31:54.488954+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 build script.
2019-09-06T21:31:54.489097+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:31:54.496430+00:00 app[web.1]:
2019-09-06T21:31:54.496561+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:31:54.496627+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_31_54_490Z-debug.log
2019-09-06T21:31:54.503294+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-09-06T21:31:54.503506+00:00 app[web.1]: npm ERR! errno 1
2019-09-06T21:31:54.504677+00:00 app[web.1]: npm ERR! paymentPlatform#0.3.0 start: `npm run build && node dist/index.js`
2019-09-06T21:31:54.504826+00:00 app[web.1]: npm ERR! Exit status 1
2019-09-06T21:31:54.505007+00:00 app[web.1]: npm ERR!
2019-09-06T21:31:54.505170+00:00 app[web.1]: npm ERR! Failed at the paymentPlatform#0.3.0 start script.
2019-09-06T21:31:54.505327+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-09-06T21:31:54.511005+00:00 app[web.1]:
2019-09-06T21:31:54.511183+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-09-06T21:31:54.511305+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-09-06T21_31_54_506Z-debug.log
2019-09-06T21:31:54.562032+00:00 heroku[web.1]: Process exited with status 1
My App is working locally, and is structured as follows:
MyApp
>package.json
>npm-debug.log
>readme.md
>client
>app
>node_modules
>public
>views
>bower.json
>Gruntfile.js
>package.json
>server
>config
>models
>node_modules
>routes
>app.js
>package.json
Deploying to heroku results in Application Error. The logs seem to indicate an issue with bcrypt dependency and with some Mongoose modules. Do I need to use something like MongoLabs for my app to work on Heroku? Also, I have some confusion about package.json and I'm not sure if I've implemented it properly. I have a package.json in my root directory and in my client directory and in my server directory.
package.json in root:
{
"name": "****",
"version": "1.0.0",
"description": "****",
"engines": {
"node": "4.4.7"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "cd server && node app.js"
},
"author": "*****",
"license": "ISC"
}
package.json in /server:
{
"name": "*****",
"version": "1.0.0",
"description": "******",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "******",
"license": "ISC",
"dependencies": {
"bcrypt": "^0.8.5",
"body-parser": "^1.13.2",
"connect-flash": "^0.1.1",
"cookie-parser": "^1.3.5",
"ejs": "^2.3.3",
"express": "^4.13.1",
"express-session": "^1.11.3",
"mongoose": "^4.1.0",
"mongoskin": "^1.3.20",
"morgan": "^1.6.1",
"passport": "^0.2.2",
"passport-local": "^1.0.0"
}
}
and, package.json in /client:
{
"name": "****",
"version": "1.0.0",
"description": "******",
"main": "Gruntfile.js",
"directories": {
"test": "tests"
},
"dependencies": {
"grunt": "^0.4.5"
},
"devDependencies": {
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-watch": "^0.6.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
heroku logs:
2016-07-31T23:12:37.522131+00:00 app[web.1]: ^
2016-07-31T23:12:37.522130+00:00 app[web.1]: throw e
2016-07-31T23:12:37.522133+00:00 app[web.1]: Error: /app/server/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
2016-07-31T23:12:37.522132+00:00 app[web.1]:
2016-07-31T23:12:37.522134+00:00 app[web.1]: at Error (native)
2016-07-31T23:12:37.522136+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:12:37.522135+00:00 app[web.1]: at Object.Module._extensions..node (module.js:434:18)
2016-07-31T23:12:37.522136+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:12:37.522137+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:12:37.522138+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:12:37.522139+00:00 app[web.1]: at Object.<anonymous> (/app/server/node_modules/bcrypt/bcrypt.js:3:35)
2016-07-31T23:12:37.522139+00:00 app[web.1]: at bindings (/app/server/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
2016-07-31T23:12:37.522140+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:12:37.522140+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-07-31T23:12:37.522141+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:12:37.522142+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:12:37.522142+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:12:37.522143+00:00 app[web.1]: at Object.<anonymous> (/app/server/models/user.js:3:23)
2016-07-31T23:12:37.522143+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:12:37.522144+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:12:37.529768+00:00 app[web.1]:
2016-07-31T23:12:37.535942+00:00 app[web.1]: npm ERR! Linux 3.13.0-91-generic
2016-07-31T23:12:37.536334+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-07-31T23:12:37.536549+00:00 app[web.1]: npm ERR! node v4.4.7
2016-07-31T23:12:37.536950+00:00 app[web.1]: npm ERR! npm v2.15.8
2016-07-31T23:12:37.537269+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-07-31T23:12:37.537447+00:00 app[web.1]: npm ERR! ****#1.0.0 start: `cd server && npm install && node app.js`
2016-07-31T23:12:37.537605+00:00 app[web.1]: npm ERR! Exit status 1
2016-07-31T23:12:37.537772+00:00 app[web.1]: npm ERR!
2016-07-31T23:12:37.537933+00:00 app[web.1]: npm ERR! Failed at the ****#1.0.0 start script 'cd server && npm install && node app.js'.
2016-07-31T23:12:37.538132+00:00 app[web.1]: npm ERR! This is most likely a problem with the **** package,
2016-07-31T23:12:37.538291+00:00 app[web.1]: npm ERR! not with npm itself.
2016-07-31T23:12:37.538445+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-07-31T23:12:37.538601+00:00 app[web.1]: npm ERR! cd server && npm install && node app.js
2016-07-31T23:12:37.538768+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-07-31T23:12:37.538926+00:00 app[web.1]: npm ERR! npm bugs ****
2016-07-31T23:12:37.539078+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-07-31T23:12:37.539248+00:00 app[web.1]: npm ERR!
2016-07-31T23:12:37.539399+00:00 app[web.1]: npm ERR! npm owner ls ****
2016-07-31T23:12:37.539536+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-07-31T23:12:37.542846+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-07-31T23:12:37.542943+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-07-31T23:12:37.542671+00:00 app[web.1]:
2016-07-31T23:12:37.613094+00:00 heroku[web.1]: Process exited with status 1
2016-07-31T23:12:37.624890+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-31T23:13:53.875013+00:00 heroku[api]: Deploy 3be7c63 by ****#gmail.com
2016-07-31T23:13:53.875094+00:00 heroku[api]: Release v20 created by ****#gmail.com
2016-07-31T23:13:54.082054+00:00 heroku[slug-compiler]: Slug compilation started
2016-07-31T23:13:54.082063+00:00 heroku[slug-compiler]: Slug compilation finished
2016-07-31T23:13:54.206719+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-31T23:13:55.623943+00:00 heroku[web.1]: Starting process with command `npm start`
2016-07-31T23:13:57.804242+00:00 app[web.1]:
2016-07-31T23:13:57.804261+00:00 app[web.1]: > ****#1.0.0 start /app
2016-07-31T23:13:57.804262+00:00 app[web.1]: > cd server && node app.js
2016-07-31T23:13:57.804263+00:00 app[web.1]:
2016-07-31T23:13:58.379535+00:00 app[web.1]: throw e
2016-07-31T23:13:58.379536+00:00 app[web.1]: ^
2016-07-31T23:13:58.379520+00:00 app[web.1]: /app/server/node_modules/bcrypt/node_modules/bindings/bindings.js:83
2016-07-31T23:13:58.379542+00:00 app[web.1]: Error: /app/server/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
2016-07-31T23:13:58.379544+00:00 app[web.1]: at Object.Module._extensions..node (module.js:434:18)
2016-07-31T23:13:58.379545+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:13:58.379537+00:00 app[web.1]:
2016-07-31T23:13:58.379543+00:00 app[web.1]: at Error (native)
2016-07-31T23:13:58.379547+00:00 app[web.1]: at bindings (/app/server/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
2016-07-31T23:13:58.379545+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:13:58.379548+00:00 app[web.1]: at Object.<anonymous> (/app/server/node_modules/bcrypt/bcrypt.js:3:35)
2016-07-31T23:13:58.379546+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:13:58.379546+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:13:58.379549+00:00 app[web.1]: at Object.Module._extensions..js (module.js:416:10)
2016-07-31T23:13:58.379548+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:13:58.379550+00:00 app[web.1]: at Function.Module._load (module.js:300:12)
2016-07-31T23:13:58.379549+00:00 app[web.1]: at Module.load (module.js:343:32)
2016-07-31T23:13:58.379551+00:00 app[web.1]: at Module.require (module.js:353:17)
2016-07-31T23:13:58.379551+00:00 app[web.1]: at require (internal/module.js:12:17)
2016-07-31T23:13:58.387711+00:00 app[web.1]:
2016-07-31T23:13:58.393911+00:00 app[web.1]: npm ERR! Linux 3.13.0-91-generic
2016-07-31T23:13:58.394517+00:00 app[web.1]: npm ERR! node v4.4.7
2016-07-31T23:13:58.379552+00:00 app[web.1]: at Object.<anonymous> (/app/server/models/user.js:3:23)
2016-07-31T23:13:58.379552+00:00 app[web.1]: at Module._compile (module.js:409:26)
2016-07-31T23:13:58.394260+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-07-31T23:13:58.395240+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-07-31T23:13:58.395014+00:00 app[web.1]: npm ERR! npm v2.15.8
2016-07-31T23:13:58.395422+00:00 app[web.1]: npm ERR! ****#1.0.0 start: `cd server && node app.js`
2016-07-31T23:13:58.396100+00:00 app[web.1]: npm ERR! This is most likely a problem with the **** package,
2016-07-31T23:13:58.396258+00:00 app[web.1]: npm ERR! not with npm itself.
2016-07-31T23:13:58.396614+00:00 app[web.1]: npm ERR! cd server && node app.js
2016-07-31T23:13:58.395590+00:00 app[web.1]: npm ERR! Exit status 1
2016-07-31T23:13:58.395926+00:00 app[web.1]: npm ERR! Failed at the ****#1.0.0 start script 'cd server && node app.js'.
2016-07-31T23:13:58.395759+00:00 app[web.1]: npm ERR!
2016-07-31T23:13:58.396416+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-07-31T23:13:58.396937+00:00 app[web.1]: npm ERR! npm bugs ****
2016-07-31T23:13:58.396770+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-07-31T23:13:58.397098+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-07-31T23:13:58.400797+00:00 app[web.1]:
2016-07-31T23:13:58.401032+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-07-31T23:13:58.397260+00:00 app[web.1]: npm ERR!
2016-07-31T23:13:58.397418+00:00 app[web.1]: npm ERR! npm owner ls ****
2016-07-31T23:13:58.397584+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-07-31T23:13:58.401189+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-07-31T23:13:58.456892+00:00 heroku[web.1]: Process exited with status 1
2016-07-31T23:13:58.447070+00:00 heroku[web.1]: State changed from starting to crashed
Solved. Turned out to be a problem with bcrypt dependency. By .gitignore'ing my node_modules and installing dependencies on heroku server side, everything working now.
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".