I created a react frontend app and worked in my pc but after deployed it in heroku, it is not working. I tried to figure it using heroku logs but didn't find a solution.I ran npm clean-install but it didn't work too.I google it but have no solution.
2021-05-13T08:38:04.301640+00:00 heroku[web.1]: Starting process with command `npm start`
2021-05-13T08:38:06.727155+00:00 app[web.1]:
2021-05-13T08:38:06.727195+00:00 app[web.1]: > smartbrain#0.1.0 start /app
2021-05-13T08:38:06.727196+00:00 app[web.1]: > react-scripts start
2021-05-13T08:38:06.727196+00:00 app[web.1]:
2021-05-13T08:38:09.716304+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.17.167.42/
2021-05-13T08:38:09.716800+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2021-05-13T08:38:09.716935+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2021-05-13T08:38:09.717057+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2021-05-13T08:38:09.718069+00:00 app[web.1]: Starting the development server...
2021-05-13T08:38:09.718070+00:00 app[web.1]:
2021-05-13T08:38:09.756192+00:00 app[web.1]: events.js:353
2021-05-13T08:38:09.756194+00:00 app[web.1]: throw er; // Unhandled 'error' event
2021-05-13T08:38:09.756194+00:00 app[web.1]: ^
2021-05-13T08:38:09.756194+00:00 app[web.1]:
2021-05-13T08:38:09.756197+00:00 app[web.1]: Error: spawn xdg-open ENOENT
2021-05-13T08:38:09.756197+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
2021-05-13T08:38:09.756200+00:00 app[web.1]: at onErrorNT (internal/child_process.js:467:16)
2021-05-13T08:38:09.756200+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:82:21)
2021-05-13T08:38:09.756201+00:00 app[web.1]: Emitted 'error' event on ChildProcess instance at:
2021-05-13T08:38:09.756201+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
2021-05-13T08:38:09.756201+00:00 app[web.1]: at onErrorNT (internal/child_process.js:467:16)
2021-05-13T08:38:09.756202+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:82:21) {
2021-05-13T08:38:09.756202+00:00 app[web.1]: errno: -2,
2021-05-13T08:38:09.756202+00:00 app[web.1]: code: 'ENOENT',
2021-05-13T08:38:09.756203+00:00 app[web.1]: syscall: 'spawn xdg-open',
2021-05-13T08:38:09.756203+00:00 app[web.1]: path: 'xdg-open',
2021-05-13T08:38:09.756204+00:00 app[web.1]: spawnargs: [ 'http://localhost:50792' ]
2021-05-13T08:38:09.756204+00:00 app[web.1]: }
2021-05-13T08:38:09.782521+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-05-13T08:38:09.782832+00:00 app[web.1]: npm ERR! errno 1
2021-05-13T08:38:09.788616+00:00 app[web.1]: npm ERR! smartbrain#0.1.0 start: `react-scripts start`
2021-05-13T08:38:09.788720+00:00 app[web.1]: npm ERR! Exit status 1
2021-05-13T08:38:09.788846+00:00 app[web.1]: npm ERR!
2021-05-13T08:38:09.788944+00:00 app[web.1]: npm ERR! Failed at the smartbrain#0.1.0 start script.
2021-05-13T08:38:09.789016+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-05-13T08:38:09.793465+00:00 app[web.1]:
2021-05-13T08:38:09.793618+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-05-13T08:38:09.793678+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-05-13T08_38_09_789Z-debug.log
2021-05-13T08:38:09.841562+00:00 heroku[web.1]: Process exited with status 1
2021-05-13T08:38:09.905305+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-13T08:38:09.908595+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-13T08:38:21.107935+00:00 heroku[web.1]: Starting process with command `npm start`
2021-05-13T08:38:24.965126+00:00 app[web.1]:
2021-05-13T08:38:24.965145+00:00 app[web.1]: > smartbrain#0.1.0 start /app
2021-05-13T08:38:24.965146+00:00 app[web.1]: > react-scripts start
2021-05-13T08:38:24.965146+00:00 app[web.1]:
2021-05-13T08:38:28.024675+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.16.195.18/
2021-05-13T08:38:28.024981+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2021-05-13T08:38:28.025126+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2021-05-13T08:38:28.025128+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2021-05-13T08:38:28.025747+00:00 app[web.1]: Starting the development server...
2021-05-13T08:38:28.025748+00:00 app[web.1]:
2021-05-13T08:38:28.064997+00:00 app[web.1]: events.js:353
2021-05-13T08:38:28.065000+00:00 app[web.1]: throw er; // Unhandled 'error' event
2021-05-13T08:38:28.065001+00:00 app[web.1]: ^
2021-05-13T08:38:28.065001+00:00 app[web.1]:
2021-05-13T08:38:28.065002+00:00 app[web.1]: Error: spawn xdg-open ENOENT
2021-05-13T08:38:28.065003+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
2021-05-13T08:38:28.065003+00:00 app[web.1]: at onErrorNT (internal/child_process.js:467:16)
2021-05-13T08:38:28.065004+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:82:21)
2021-05-13T08:38:28.065004+00:00 app[web.1]: Emitted 'error' event on ChildProcess instance at:
2021-05-13T08:38:28.065005+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
2021-05-13T08:38:28.065005+00:00 app[web.1]: at onErrorNT (internal/child_process.js:467:16)
2021-05-13T08:38:28.065005+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:82:21) {
2021-05-13T08:38:28.065006+00:00 app[web.1]: errno: -2,
2021-05-13T08:38:28.065006+00:00 app[web.1]: code: 'ENOENT',
2021-05-13T08:38:28.065006+00:00 app[web.1]: syscall: 'spawn xdg-open',
2021-05-13T08:38:28.065006+00:00 app[web.1]: path: 'xdg-open',
2021-05-13T08:38:28.065007+00:00 app[web.1]: spawnargs: [ 'http://localhost:11787' ]
2021-05-13T08:38:28.065007+00:00 app[web.1]: }
2021-05-13T08:38:28.094099+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-05-13T08:38:28.094508+00:00 app[web.1]: npm ERR! errno 1
2021-05-13T08:38:28.102975+00:00 app[web.1]: npm ERR! smartbrain#0.1.0 start: `react-scripts start`
2021-05-13T08:38:28.103358+00:00 app[web.1]: npm ERR!
2021-05-13T08:38:28.103494+00:00 app[web.1]: npm ERR! Failed at the smartbrain#0.1.0 start script.
2021-05-13T08:38:28.103631+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-05-13T08:38:28.114721+00:00 app[web.1]:
2021-05-13T08:38:28.114990+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-05-13T08:38:28.115138+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-05-13T08_38_28_104Z-debug.log
2021-05-13T08:38:28.169652+00:00 heroku[web.1]: Process exited with status 1
2021-05-13T08:38:28.229144+00:00 heroku[web.1]: State changed from starting to crashed
the logs are above, can any one help me to solve this problem?
You should build a production version and serve it...
you can have a script like this
"start": "serve -s build",
"dev": "react-script start"
By default heroku will run the build script... Make sure to add serve as part of your dependencies
https://www.npmjs.com/package/serve
Related
I have nooooooo idea what happened or how to fix it. But I know the build and deploy succeeded, yet there was an error when it tried to serve on the heroku domain. This is the log
2021-09-23T17:54:03.000000+00:00 app[api]: Build started by user lotusms#outlook.com
2021-09-23T17:57:33.106282+00:00 app[api]: Deploy 311dbfec by user lotusms#outlook.com
2021-09-23T17:57:33.106282+00:00 app[api]: Release v5 created by user lotusms#outlook.com
2021-09-23T17:57:33.643634+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-23T17:57:34.000000+00:00 app[api]: Build succeeded
2021-09-23T17:57:41.831375+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-23T17:57:42.751649+00:00 app[web.1]:
2021-09-23T17:57:42.751663+00:00 app[web.1]: > luis-portfolio#1.0.0 start /app
2021-09-23T17:57:42.751664+00:00 app[web.1]: > node backend/server.js
2021-09-23T17:57:42.751664+00:00 app[web.1]:
2021-09-23T17:57:42.850572+00:00 app[web.1]: internal/modules/cjs/loader.js:892
2021-09-23T17:57:42.850573+00:00 app[web.1]: throw err;
2021-09-23T17:57:42.850574+00:00 app[web.1]: ^
2021-09-23T17:57:42.850574+00:00 app[web.1]:
2021-09-23T18:11:55.176407+00:00 app[web.1]: Error: Cannot find module 'express-handlebars'
2021-09-23T18:11:55.176408+00:00 app[web.1]: Require stack:
2021-09-23T18:11:55.176408+00:00 app[web.1]: - /app/backend/server.js
2021-09-23T18:11:55.176409+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
2021-09-23T18:11:55.176409+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:745:27)
2021-09-23T18:11:55.176410+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:961:19)
2021-09-23T18:11:55.176410+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:92:18)
2021-09-23T18:11:55.176410+00:00 app[web.1]: at Object.<anonymous> (/app/backend/server.js:3:25)
2021-09-23T18:11:55.176410+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-23T18:11:55.176411+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-23T18:11:55.176411+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-23T18:11:55.176411+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-23T18:11:55.176412+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2021-09-23T18:11:55.176413+00:00 app[web.1]: requireStack: [ '/app/backend/server.js' ]
2021-09-23T18:11:55.183165+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-23T18:11:55.183332+00:00 app[web.1]: npm ERR! errno 1
2021-09-23T18:11:55.187383+00:00 app[web.1]: npm ERR! luis-portfolio#1.0.0 start: `node backend/server.js`
2021-09-23T18:11:55.187508+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-23T18:11:55.187587+00:00 app[web.1]: npm ERR!
2021-09-23T18:11:55.187645+00:00 app[web.1]: npm ERR! Failed at the luis-portfolio#1.0.0 start script.
2021-09-23T18:11:55.187699+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-23T18:11:55.193992+00:00 app[web.1]:
2021-09-23T18:11:55.194070+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-23T18:11:55.194101+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-23T18_11_55_188Z-debug.log
2021-09-23T18:11:55.308995+00:00 heroku[web.1]: Process exited with status 1
2021-09-23T18:11:55.387625+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-23T18:18:11.000000+00:00 app[api]: Build started by user lotusms#outlook.com
2021-09-23T18:21:37.829987+00:00 app[api]: Deploy 3133e1a6 by user lotusms#outlook.com
2021-09-23T18:21:37.829987+00:00 app[api]: Release v7 created by user lotusms#outlook.com
2021-09-23T18:21:38.000000+00:00 app[api]: Build succeeded
2021-09-23T18:21:38.201741+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-23T18:21:48.297944+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-23T18:21:49.385182+00:00 app[web.1]:
2021-09-23T18:21:49.385194+00:00 app[web.1]: > luis-portfolio#1.0.0 start /app
2021-09-23T18:21:49.385194+00:00 app[web.1]: > node backend/server.js
2021-09-23T18:21:49.385195+00:00 app[web.1]:
2021-09-23T18:21:49.496716+00:00 app[web.1]: internal/modules/cjs/loader.js:892
2021-09-23T18:21:49.496718+00:00 app[web.1]: throw err;
2021-09-23T18:21:49.496718+00:00 app[web.1]: ^
2021-09-23T18:21:49.496719+00:00 app[web.1]:
2021-09-23T18:21:49.496719+00:00 app[web.1]: Error: Cannot find module 'cors'
2021-09-23T18:21:49.496719+00:00 app[web.1]: Require stack:
2021-09-23T18:21:49.496720+00:00 app[web.1]: - /app/backend/server.js
2021-09-23T18:21:49.496720+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
2021-09-23T18:21:49.496720+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:745:27)
2021-09-23T18:21:49.496721+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:961:19)
2021-09-23T18:21:49.496721+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:92:18)
2021-09-23T18:21:49.496722+00:00 app[web.1]: at Object.<anonymous> (/app/backend/server.js:5:25)
2021-09-23T18:21:49.496722+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-23T18:21:49.496722+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-23T18:21:49.496723+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-23T18:21:49.496723+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-23T18:21:49.496723+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
2021-09-23T18:21:49.496724+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2021-09-23T18:21:49.496724+00:00 app[web.1]: requireStack: [ '/app/backend/server.js' ]
2021-09-23T18:21:49.496724+00:00 app[web.1]: }
2021-09-23T18:21:49.512189+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-23T18:21:49.512362+00:00 app[web.1]: npm ERR! errno 1
2021-09-23T18:21:49.515739+00:00 app[web.1]: npm ERR! luis-portfolio#1.0.0 start: `node backend/server.js`
2021-09-23T18:21:49.515768+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-23T18:21:49.515827+00:00 app[web.1]: npm ERR!
2021-09-23T18:21:49.515861+00:00 app[web.1]: npm ERR! Failed at the luis-portfolio#1.0.0 start script.
2021-09-23T18:21:49.515902+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-23T18:21:49.611964+00:00 app[web.1]:
2021-09-23T18:21:49.612101+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-23T18:21:49.612151+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-23T18_21_49_516Z-debug.log
2021-09-23T18:21:49.736450+00:00 heroku[web.1]: Process exited with status 1
2021-09-23T18:21:49.804463+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-23T18:21:51.473081+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=radiant-brook-92705.herokuapp.com request_id=6652a47c-6241-4d4f-a967-ebd6c8db8091 fwd="71.57.243.26" dyno= connect= service= status=503 bytes= protocol=https
Luiss-Mac-mini:luis-portfolio lotusms$ heroku logs
2021-09-23T18:23:37.573784+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-23T18:23:37.573953+00:00 app[web.1]: npm ERR! errno 1
2021-09-23T18:23:37.577270+00:00 app[web.1]: npm ERR! luis-portfolio#1.0.0 start: `node backend/server.js`
2021-09-23T18:23:37.577315+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-23T18:23:37.577365+00:00 app[web.1]: npm ERR!
2021-09-23T18:23:37.577402+00:00 app[web.1]: npm ERR! Failed at the luis-portfolio#1.0.0 start script.
2021-09-23T18:23:37.577442+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-23T18:23:37.580907+00:00 app[web.1]:
2021-09-23T18:23:37.580982+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-23T18:23:37.581018+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-23T18_23_37_577Z-debug.log
2021-09-23T18:23:37.695597+00:00 heroku[web.1]: Process exited with status 1
2021-09-23T18:23:37.741882+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-23T18:23:37.746297+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-23T18:23:47.676591+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-23T18:23:48.916311+00:00 app[web.1]:
2021-09-23T18:23:48.916324+00:00 app[web.1]: > luis-portfolio#1.0.0 start /app
2021-09-23T18:23:48.916325+00:00 app[web.1]: > node backend/server.js
2021-09-23T18:23:48.916325+00:00 app[web.1]:
2021-09-23T18:23:49.020052+00:00 app[web.1]: internal/modules/cjs/loader.js:892
2021-09-23T18:23:49.020053+00:00 app[web.1]: throw err;
2021-09-23T18:23:49.020054+00:00 app[web.1]: ^
2021-09-23T18:23:49.020054+00:00 app[web.1]:
Luiss-Mac-mini:luis-portfolio lotusms$
What is going in here?
P.S. It's an app built with React in a client folder, and Express in a backend folder. Then an main package running the following
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon --watch backend --exec node backend/server.js",
"server": "nodemon backend/server.js",
"client": "npm start --prefix client",
"frontend": "npm run start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run start --prefix client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
Thanks in advance
Well, here's what fixed it for me. First of all this may be different for you if you have a different root architecture than mine. Your package.json and node_modules and dependencies may be in different places. But you can at least use my solution as a reference and adjust accordingly.
Root Struture
node_modules
package.json //we'll call it root-package for reference
- backend
- node_modules
package.json //we'll call it backend-package for reference
server.js
- client
- node_modules
- public
- build
- src
package.json //we'll call it frontend-package for reference
Though my entry is server.js in the backend folder, I am actually entering through an outer wrapping folder so I can keep a separation of concerns between the backend and client.
I moved all my package.json packages installed in devDependencies to the dependencies folder and made sure that my root-package.json served both of my backend-package.json and frontend-package.json concurrently and the directory was correct.
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"client-install": "npm install --prefix client",
"start": "node backend/server.js",
"server": "nodemon backend/server.js",
"client": "npm start --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"
},
I have deployed my react application in heroku. Build was successful. When I try to run the apllication I am getting an Application error. The error is
021-09-05T18:09:02.093946+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-05T18:09:04.858809+00:00 app[web.1]:
2021-09-05T18:09:04.858836+00:00 app[web.1]: > photoshare#1.0.0 start /app
2021-09-05T18:09:04.858837+00:00 app[web.1]: > node server.js
2021-09-05T18:09:04.858837+00:00 app[web.1]:
2021-09-05T18:09:05.373833+00:00 app[web.1]: internal/modules/cjs/loader.js:892
2021-09-05T18:09:05.373849+00:00 app[web.1]: throw err;
2021-09-05T18:09:05.373850+00:00 app[web.1]:
2021-09-05T18:09:05.373850+00:00 app[web.1]:
2021-09-05T18:09:05.373850+00:00 app[web.1]: Error: Cannot find module './routes/api/users'
2021-09-05T18:09:05.373850+00:00 app[web.1]: Require stack:
2021-09-05T18:09:05.373851+00:00 app[web.1]: - /app/server.js
2021-09-05T18:09:05.373851+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
2021-09-05T18:09:05.373852+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:745:27)
2021-09-05T18:09:05.373852+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:961:19)
2021-09-05T18:09:05.373853+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:92:18)
2021-09-05T18:09:05.373853+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:5:15)
2021-09-05T18:09:05.373853+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-05T18:09:05.373853+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-05T18:09:05.373854+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-05T18:09:05.373854+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-05T18:09:05.373854+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-09-05T18:09:05.373855+00:00 app[web.1]: at internal/main/run_main_module.js:17:47 {
2021-09-05T18:09:05.373855+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2021-09-05T18:09:05.373855+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2021-09-05T18:09:05.373856+00:00 app[web.1]: }
2021-09-05T18:09:05.385287+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-05T18:09:05.385456+00:00 app[web.1]: npm ERR! errno 1
2021-09-05T18:09:05.388896+00:00 app[web.1]: npm ERR! photoshare#1.0.0 start: `node server.js`
2021-09-05T18:09:05.388956+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-05T18:09:05.389019+00:00 app[web.1]: npm ERR!
2021-09-05T18:09:05.389068+00:00 app[web.1]: npm ERR! Failed at the photoshare#1.0.0 start script.
2021-09-05T18:09:05.389117+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-05T18:09:05.393542+00:00 app[web.1]:
Check this in your code ./routes/api/users. May be you reference it in wrong way.
Or the better is to create and absolute path:
const path = require('path');
const yourAbsolutePath = path.join( __dirname,'./routes/api/users');
make sure ./routes/api/users is well referenced relative to __dirname
So I'm having some issues with pushing my app to heroku. Locally it runs and builds fine but it crashes when I try to deploy on heroku. Here's the log I'm seeing after deploying to heroku:
2017-05-18T16:56:47.252771+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the pluralsight-redux-starter package,
2017-05-18T16:56:47.252849+00:00 app[web.1]: npm ERR! not with npm itself.
2017-05-18T16:56:47.252939+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-05-18T16:56:47.253015+00:00 app[web.1]: npm ERR! npm run build:html
2017-05-18T16:56:47.253089+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-05-18T16:56:47.253159+00:00 app[web.1]: npm ERR! npm bugs pluralsight-redux-starter
2017-05-18T16:56:47.253227+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-05-18T16:56:47.253304+00:00 app[web.1]: npm ERR! npm owner ls pluralsight-redux-starter
2017-05-18T16:56:47.253382+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-05-18T16:56:47.256870+00:00 app[web.1]:
2017-05-18T16:56:47.257025+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-05-18T16:56:47.257079+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-05-18T16:56:47.345310+00:00 heroku[web.1]: State changed from starting to crashed
2017-05-18T16:56:47.336090+00:00 heroku[web.1]: Process exited with status 1
2017-05-18T16:55:58.000000+00:00 app[api]: Build succeeded
2017-05-18T16:59:46.000000+00:00 app[api]: Build started by user dgravelle54#gmail.com
2017-05-18T17:00:08.286603+00:00 app[api]: Release v4 created by user dgravelle54#gmail.com
2017-05-18T17:00:08.286603+00:00 app[api]: Deploy 8f4c395a by user dgravelle54#gmail.com
2017-05-18T17:00:08.618011+00:00 heroku[web.1]: State changed from crashed to starting
2017-05-18T16:59:46.000000+00:00 app[api]: Build succeeded
2017-05-18T17:00:11.772019+00:00 heroku[web.1]: Starting process with command `npm run build`
2017-05-18T17:00:14.380808+00:00 app[web.1]:
2017-05-18T17:00:14.380822+00:00 app[web.1]: > pluralsight-redux-starter#1.0.0 prebuild /app
2017-05-18T17:00:14.380823+00:00 app[web.1]: > npm run build:html
2017-05-18T17:00:14.380823+00:00 app[web.1]:
2017-05-18T17:00:15.182395+00:00 app[web.1]:
2017-05-18T17:00:15.182406+00:00 app[web.1]: > pluralsight-redux-starter#1.0.0 build:html /app
2017-05-18T17:00:15.182407+00:00 app[web.1]: > babel-node tools/buildHtml.js
2017-05-18T17:00:15.182408+00:00 app[web.1]:
2017-05-18T17:00:16.180115+00:00 app[web.1]: /app/node_modules/babel-core/lib/transformation/file/logger.js:41
2017-05-18T17:00:16.180126+00:00 app[web.1]: throw new Constructor(this._buildMessage(msg));
2017-05-18T17:00:16.180127+00:00 app[web.1]: ^
2017-05-18T17:00:16.180128+00:00 app[web.1]:
2017-05-18T17:00:16.180129+00:00 app[web.1]: ReferenceError: [BABEL] /app/tools/buildHtml.js: Unknown option: base.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.
2017-05-18T17:00:16.180131+00:00 app[web.1]: A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:
2017-05-18T17:00:16.180131+00:00 app[web.1]:
2017-05-18T17:00:16.180129+00:00 app[web.1]:
2017-05-18T17:00:16.180132+00:00 app[web.1]: Invalid:
2017-05-18T17:00:16.180133+00:00 app[web.1]: `{ presets: [{option: value}] }`
2017-05-18T17:00:16.180134+00:00 app[web.1]: Valid:
2017-05-18T17:00:16.180134+00:00 app[web.1]: `{ presets: [['presetName', {option: value}]] }`
2017-05-18T17:00:16.180135+00:00 app[web.1]:
2017-05-18T17:00:16.180137+00:00 app[web.1]: at Logger.error (/app/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
2017-05-18T17:00:16.180136+00:00 app[web.1]: For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.
2017-05-18T17:00:16.180137+00:00 app[web.1]: at OptionManager.mergeOptions (/app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:226:20)
2017-05-18T17:00:16.180138+00:00 app[web.1]: at OptionManager.init (/app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
2017-05-18T17:00:16.180139+00:00 app[web.1]: at File.initOptions (/app/node_modules/babel-core/lib/transformation/file/index.js:212:65)
2017-05-18T17:00:16.180140+00:00 app[web.1]: at new File (/app/node_modules/babel-core/lib/transformation/file/index.js:135:24)
2017-05-18T17:00:16.180141+00:00 app[web.1]: at Pipeline.transform (/app/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
2017-05-18T17:00:16.180142+00:00 app[web.1]: at compile (/app/node_modules/babel-register/lib/node.js:118:20)
2017-05-18T17:00:16.180142+00:00 app[web.1]: at loader (/app/node_modules/babel-register/lib/node.js:144:14)
2017-05-18T17:00:16.180143+00:00 app[web.1]: at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7)
2017-05-18T17:00:16.180141+00:00 app[web.1]: at Object.transformFileSync (/app/node_modules/babel-core/lib/api/node.js:152:10)
2017-05-18T17:00:16.204296+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "run" "build:html"
2017-05-18T17:00:16.204685+00:00 app[web.1]: npm ERR! npm v3.10.10
2017-05-18T17:00:16.204883+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-05-18T17:00:16.193941+00:00 app[web.1]:
2017-05-18T17:00:16.205084+00:00 app[web.1]: npm ERR! pluralsight-redux-starter#1.0.0 build:html: `babel-node tools/buildHtml.js`
2017-05-18T17:00:16.204007+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-05-18T17:00:16.204494+00:00 app[web.1]: npm ERR! node v6.10.3
2017-05-18T17:00:16.205216+00:00 app[web.1]: npm ERR! Exit status 1
2017-05-18T17:00:16.205385+00:00 app[web.1]: npm ERR!
2017-05-18T17:00:16.205521+00:00 app[web.1]: npm ERR! Failed at the pluralsight-redux-starter#1.0.0 build:html script 'babel-node tools/buildHtml.js'.
2017-05-18T17:00:16.205654+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-05-18T17:00:16.205790+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the pluralsight-redux-starter package,
2017-05-18T17:00:16.205926+00:00 app[web.1]: npm ERR! not with npm itself.
2017-05-18T17:00:16.206069+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-05-18T17:00:16.206205+00:00 app[web.1]: npm ERR! babel-node tools/buildHtml.js
2017-05-18T17:00:16.206343+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-05-18T17:00:16.206474+00:00 app[web.1]: npm ERR! npm bugs pluralsight-redux-starter
2017-05-18T17:00:16.206616+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-05-18T17:00:16.206746+00:00 app[web.1]: npm ERR! npm owner ls pluralsight-redux-starter
2017-05-18T17:00:16.206883+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-05-18T17:00:16.210443+00:00 app[web.1]:
2017-05-18T17:00:16.210851+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-05-18T17:00:16.210971+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-05-18T17:00:16.222137+00:00 app[web.1]:
2017-05-18T17:00:16.229747+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-05-18T17:00:16.230016+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "run" "build"
2017-05-18T17:00:16.230230+00:00 app[web.1]: npm ERR! node v6.10.3
2017-05-18T17:00:16.230422+00:00 app[web.1]: npm ERR! npm v3.10.10
2017-05-18T17:00:16.230611+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-05-18T17:00:16.230764+00:00 app[web.1]: npm ERR! pluralsight-redux-starter#1.0.0 prebuild: `npm run build:html`
2017-05-18T17:00:16.230889+00:00 app[web.1]: npm ERR! Exit status 1
2017-05-18T17:00:16.231035+00:00 app[web.1]: npm ERR!
2017-05-18T17:00:16.231171+00:00 app[web.1]: npm ERR! Failed at the pluralsight-redux-starter#1.0.0 prebuild script 'npm run build:html'.
2017-05-18T17:00:16.231297+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-05-18T17:00:16.231428+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the pluralsight-redux-starter package,
2017-05-18T17:00:16.231554+00:00 app[web.1]: npm ERR! not with npm itself.
2017-05-18T17:00:16.231697+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-05-18T17:00:16.231827+00:00 app[web.1]: npm ERR! npm run build:html
2017-05-18T17:00:16.231955+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-05-18T17:00:16.232183+00:00 app[web.1]: npm ERR! npm bugs pluralsight-redux-starter
2017-05-18T17:00:16.232315+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-05-18T17:00:16.232440+00:00 app[web.1]: npm ERR! npm owner ls pluralsight-redux-starter
2017-05-18T17:00:16.232578+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-05-18T17:00:16.236064+00:00 app[web.1]:
2017-05-18T17:00:16.236264+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-05-18T17:00:16.236373+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-05-18T17:00:16.327400+00:00 heroku[web.1]: Process exited with status 1
2017-05-18T17:00:16.337382+00:00 heroku[web.1]: State changed from starting to crashed
Here's a link to my current repo.
https://github.com/dgravelle/magic-redux
I've gone through a bunch of iterations now trying to get this working on heroku but I've had no success. If anyone could shed some light on the issue here I'd greatly appreciate it. Thanks!
on Heroku, you are not a root administrator, it means that you don't have the write permission.
if you want to run your server on heroku, I think you can try to bundle your file in your local.
I am trying to deploy an angular app with node.js in the back to heroku and I keep getting these errors. I checked heroku logs and this error was returned.
$ heroku logs
2017-03-28T19:39:19.558737+00:00 app[web.1]: at Function.Module._load (module.js:417:25)
2017-03-28T19:39:19.558740+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-03-28T19:39:19.558738+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-03-28T19:39:19.558740+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-03-28T19:39:19.558741+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-03-28T19:39:19.558741+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-03-28T19:39:19.558742+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2017-03-28T19:39:19.558744+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-03-28T19:39:19.558743+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-03-28T19:39:19.558745+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-03-28T19:39:19.558743+00:00 app[web.1]: at require (internal/module.js:20:19)
2017-03-28T19:39:19.568956+00:00 app[web.1]:
2017-03-28T19:39:19.558744+00:00 app[web.1]: at Object.<anonymous> (/app/bin/www:7:11)
2017-03-28T19:39:19.558746+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-03-28T19:39:19.576891+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-03-28T19:39:19.577955+00:00 app[web.1]: npm ERR! Exit status 1
2017-03-28T19:39:19.578118+00:00 app[web.1]: npm ERR!
2017-03-28T19:39:19.577095+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-03-28T19:39:19.578397+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-03-28T19:39:19.577245+00:00 app[web.1]: npm ERR! node v6.10.1
2017-03-28T19:39:19.577457+00:00 app[web.1]: npm ERR! npm v3.10.10
2017-03-28T19:39:19.577660+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-03-28T19:39:19.577817+00:00 app[web.1]: npm ERR! swiping#0.0.0 start: `node bin/www`
2017-03-28T19:39:19.578260+00:00 app[web.1]: npm ERR! Failed at the swiping#0.0.0 start script 'node bin/www'.
2017-03-28T19:39:19.580186+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-03-28T19:39:19.578536+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the swiping package,
2017-03-28T19:39:19.578674+00:00 app[web.1]: npm ERR! not with npm itself.
2017-03-28T19:39:19.579513+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-03-28T19:39:19.579652+00:00 app[web.1]: npm ERR! node bin/www
2017-03-28T19:39:19.580319+00:00 app[web.1]: npm ERR! npm owner ls swiping
2017-03-28T19:39:19.579787+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-03-28T19:39:19.580044+00:00 app[web.1]: npm ERR! npm bugs swiping
2017-03-28T19:39:19.584013+00:00 app[web.1]:
2017-03-28T19:39:19.580460+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-03-28T19:39:19.584213+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-03-28T19:39:19.584307+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-03-28T19:39:19.665671+00:00 heroku[web.1]: Process exited with status 1
2017-03-28T19:39:19.683203+00:00 heroku[web.1]: State changed from starting to crashed
2017-03-28T19:50:32.379502+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-28T19:50:36.835295+00:00 heroku[web.1]: Starting process with command `npm start`
2017-03-28T19:50:40.588438+00:00 app[web.1]: > swiping#0.0.0 start /app
2017-03-28T19:50:40.588424+00:00 app[web.1]:
2017-03-28T19:50:40.588439+00:00 app[web.1]: > node bin/www
2017-03-28T19:50:40.588439+00:00 app[web.1]:
2017-03-28T19:50:40.884038+00:00 app[web.1]: { Error: ENOENT: no such file or directory, open '.env'
2017-03-28T19:50:40.884053+00:00 app[web.1]: at Error (native)
2017-03-28T19:50:40.884054+00:00 app[web.1]: at Object.fs.openSync (fs.js:641:18)
2017-03-28T19:50:40.884055+00:00 app[web.1]: at Object.fs.readFileSync (fs.js:509:33)
2017-03-28T19:50:40.884056+00:00 app[web.1]: at Object.config (/app/node_modules/dotenv/lib/main.js:30:37)
2017-03-28T19:50:40.884056+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:7:19)
2017-03-28T19:50:40.884057+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-03-28T19:50:40.884057+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-03-28T19:50:40.884058+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-03-28T19:50:40.884058+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-03-28T19:50:40.884060+00:00 app[web.1]: at Function.Module._load (module.js:438:3) errno: -2, code: 'ENOENT', syscall: 'open', path: '.env' }
2017-03-28T19:50:41.499429+00:00 app[web.1]: module.js:471
2017-03-28T19:50:41.499443+00:00 app[web.1]: throw err;
2017-03-28T19:50:41.499444+00:00 app[web.1]: ^
2017-03-28T19:50:41.499445+00:00 app[web.1]:
2017-03-28T19:50:41.499446+00:00 app[web.1]: Error: Cannot find module 'stripe'
2017-03-28T19:50:41.499447+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:469:15)
2017-03-28T19:50:41.499448+00:00 app[web.1]: at Function.Module._load (module.js:417:25)
2017-03-28T19:50:41.499450+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-03-28T19:50:41.499450+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:23:31)
2017-03-28T19:50:41.499452+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-03-28T19:50:41.499449+00:00 app[web.1]: at require (internal/module.js:20:19)
2017-03-28T19:50:41.499448+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-03-28T19:50:41.499451+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-03-28T19:50:41.499453+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-03-28T19:50:41.499453+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2017-03-28T19:50:41.499454+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-03-28T19:50:41.499454+00:00 app[web.1]: at require (internal/module.js:20:19)
2017-03-28T19:50:41.499455+00:00 app[web.1]: at Object.<anonymous> (/app/bin/www:7:11)
2017-03-28T19:50:41.499456+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-03-28T19:50:41.499456+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-03-28T19:50:41.499457+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-03-28T19:50:41.518990+00:00 app[web.1]:
2017-03-28T19:50:41.533527+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-03-28T19:50:41.533975+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-03-28T19:50:41.534366+00:00 app[web.1]: npm ERR! node v6.10.1
2017-03-28T19:50:41.534659+00:00 app[web.1]: npm ERR! npm v3.10.10
2017-03-28T19:50:41.534971+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-03-28T19:50:41.535416+00:00 app[web.1]: npm ERR! Exit status 1
2017-03-28T19:50:41.535202+00:00 app[web.1]: npm ERR! swiping#0.0.0 start: `node bin/www`
2017-03-28T19:50:41.536538+00:00 app[web.1]: npm ERR!
2017-03-28T19:50:41.536786+00:00 app[web.1]: npm ERR! Failed at the swiping#0.0.0 start script 'node bin/www'.
2017-03-28T19:50:41.537264+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the swiping package,
2017-03-28T19:50:41.537011+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-03-28T19:50:41.538192+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-03-28T19:50:41.537489+00:00 app[web.1]: npm ERR! not with npm itself.
2017-03-28T19:50:41.538418+00:00 app[web.1]: npm ERR! node bin/www
2017-03-28T19:50:41.538660+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-03-28T19:50:41.538885+00:00 app[web.1]: npm ERR! npm bugs swiping
2017-03-28T19:50:41.539142+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-03-28T19:50:41.539657+00:00 app[web.1]: npm ERR! npm owner ls swiping
2017-03-28T19:50:41.539883+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-03-28T19:50:41.545636+00:00 app[web.1]:
2017-03-28T19:50:41.545943+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-03-28T19:50:41.546128+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-03-28T19:50:41.644752+00:00 heroku[web.1]: Process exited with status 1
2017-03-28T19:50:41.660900+00:00 heroku[web.1]: State changed from starting to crashed
Any suggestions, I adjusted the package.json to start on node bin/www because that is how I start the app on my local host. There also seems to be a problem with the .env file being seen. And please ignore the errors related to stripe, thank you
Looks like you're missing a Node module by the name of stripe. If you've included it in your devDependencies, Heroku does not install those. You'll have to move it to the dependencies property for it to be properly utilized in your app. You should also remove the .env file from your GitHub repo, as toddg describes in his answer.
Remove your .env from your git repo.
Create a .gitignore file
From the command line: touch .gitignore
open the file you just created (either use vi or your favorite text editor) and add the following line:
.env
Since .env is already tracked you'll need to remove it from being tracked:
git rm --cached .env
Then commit and redeploy to Heroku
Solved problem. Remove all localhost used package.json change the directory to your own app.js or your root js file name. Give ng build. Upload to herokuapp.
I'm new to heroku app deployment.. I did it all the steps describe in deployment process also defined all config var.. but still I'm not able to run the application .. this is the log I got from heroku.. please if anyone can tell me what am I doing wrong or missing here
also it is giving MongoError: Authentication failed though I have declare config vars in heroku for mongodb connection as MONGOLAB_URI key..
2016-12-25T11:51:14.676128+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=demo-fullstack.herokuapp.com request_id=673145a1-c8ce-4f2c-a717-b3bfe05c5b
01 fwd="116.73.192.203" dyno= connect= service= status=503 bytes=
2016-12-25T11:51:15.091210+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=demo-fullstack.herokuapp.com request_id=05f9ef8a-1d51-4f0e-addb
-1a32ca0afff2 fwd="116.73.192.203" dyno= connect= service= status=503 bytes=
2016-12-25T11:58:07.431140+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-25T11:58:09.585660+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-25T11:58:11.842396+00:00 app[web.1]:
2016-12-25T11:58:11.842417+00:00 app[web.1]: > testfullstack#0.0.0 start /app
2016-12-25T11:58:11.842419+00:00 app[web.1]:
2016-12-25T11:58:11.842418+00:00 app[web.1]: > node server/app.js
2016-12-25T11:58:12.800506+00:00 app[web.1]: Express server listening on 10075, in production mode
2016-12-25T11:58:12.853885+00:00 app[web.1]: MongoDB connection error: MongoError: Authentication failed.
2016-12-25T11:58:12.870567+00:00 app[web.1]:
2016-12-25T11:58:12.877910+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2016-12-25T11:58:12.877951+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-12-25T11:58:12.878095+00:00 app[web.1]: npm ERR! node v6.9.1
2016-12-25T11:58:12.878212+00:00 app[web.1]: npm ERR! npm v3.10.8
2016-12-25T11:58:12.878334+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-12-25T11:58:12.878429+00:00 app[web.1]: npm ERR! testfullstack#0.0.0 start: `node server/app.js`
2016-12-25T11:58:12.878531+00:00 app[web.1]: npm ERR! Exit status 255
2016-12-25T11:58:12.878647+00:00 app[web.1]: npm ERR!
2016-12-25T11:58:12.878731+00:00 app[web.1]: npm ERR! Failed at the testfullstack#0.0.0 start script 'node server/app.js'.
2016-12-25T11:58:12.878807+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-12-25T11:58:12.878873+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the testfullstack package,
2016-12-25T11:58:12.878943+00:00 app[web.1]: npm ERR! not with npm itself.
2016-12-25T11:58:12.879039+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-12-25T11:58:12.879108+00:00 app[web.1]: npm ERR! node server/app.js
2016-12-25T11:58:12.879191+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-12-25T11:58:12.879382+00:00 app[web.1]: npm ERR! npm bugs testfullstack
2016-12-25T11:58:12.879463+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-12-25T11:58:12.879534+00:00 app[web.1]: npm ERR! npm owner ls testfullstack
2016-12-25T11:58:12.879649+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-12-25T11:58:12.883330+00:00 app[web.1]:
2016-12-25T11:58:12.883479+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-12-25T11:58:12.883553+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-12-25T11:58:12.961081+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-25T11:58:12.962211+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-25T11:58:12.952734+00:00 heroku[web.1]: Process exited with status 1
2016-12-25T11:58:14.598687+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-25T11:58:15.646836+00:00 app[web.1]:
2016-12-25T11:58:15.646847+00:00 app[web.1]: > testfullstack#0.0.0 start /app
2016-12-25T11:58:15.646847+00:00 app[web.1]: > node server/app.js
2016-12-25T11:58:15.646848+00:00 app[web.1]:
2016-12-25T11:58:16.389173+00:00 app[web.1]: Express server listening on 38372, in production mode
2016-12-25T11:58:16.436177+00:00 app[web.1]: MongoDB connection error: MongoError: Authentication failed.
2016-12-25T11:58:16.445122+00:00 app[web.1]:
2016-12-25T11:58:16.452364+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2016-12-25T11:58:16.452548+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-12-25T11:58:16.452685+00:00 app[web.1]: npm ERR! node v6.9.1
2016-12-25T11:58:16.452807+00:00 app[web.1]: npm ERR! npm v3.10.8
2016-12-25T11:58:16.452925+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-12-25T11:58:16.453022+00:00 app[web.1]: npm ERR! testfullstack#0.0.0 start: `node server/app.js`
2016-12-25T11:58:16.453103+00:00 app[web.1]: npm ERR! Exit status 255
2016-12-25T11:58:16.453195+00:00 app[web.1]: npm ERR!
2016-12-25T11:58:16.453276+00:00 app[web.1]: npm ERR! Failed at the testfullstack#0.0.0 start script 'node server/app.js'.
2016-12-25T11:58:16.453355+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-12-25T11:58:16.453433+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the testfullstack package,
2016-12-25T11:58:16.453512+00:00 app[web.1]: npm ERR! not with npm itself.
2016-12-25T11:58:16.453601+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-12-25T11:58:16.453679+00:00 app[web.1]: npm ERR! node server/app.js
2016-12-25T11:58:16.453762+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-12-25T11:58:16.453840+00:00 app[web.1]: npm ERR! npm bugs testfullstack
2016-12-25T11:58:16.454017+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-12-25T11:58:16.454098+00:00 app[web.1]: npm ERR! npm owner ls testfullstack
2016-12-25T11:58:16.454176+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-12-25T11:58:16.457449+00:00 app[web.1]:
2016-12-25T11:58:16.457596+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-12-25T11:58:16.457665+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-12-25T11:58:16.520594+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-25T11:58:16.492087+00:00 heroku[web.1]: Process exited with status 1
2016-12-25T12:20:14.300271+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-25T12:20:16.246959+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-25T12:20:18.706498+00:00 app[web.1]:
2016-12-25T12:20:18.706509+00:00 app[web.1]: > testfullstack#0.0.0 start /app
2016-12-25T12:20:18.706510+00:00 app[web.1]: > node server/app.js
2016-12-25T12:20:18.706511+00:00 app[web.1]:
2016-12-25T12:20:19.622220+00:00 app[web.1]: Express server listening on 28155, in production mode
2016-12-25T12:20:19.710471+00:00 app[web.1]: MongoDB connection error: MongoError: Authentication failed.
2016-12-25T12:20:19.726340+00:00 app[web.1]:
2016-12-25T12:20:19.738178+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2016-12-25T12:20:19.738427+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-12-25T12:20:19.738641+00:00 app[web.1]: npm ERR! node v6.9.1
2016-12-25T12:20:19.738825+00:00 app[web.1]: npm ERR! npm v3.10.8
2016-12-25T12:20:19.739011+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-12-25T12:20:19.739166+00:00 app[web.1]: npm ERR! testfullstack#0.0.0 start: `node server/app.js`
2016-12-25T12:20:19.739573+00:00 app[web.1]: npm ERR! Failed at the testfullstack#0.0.0 start script 'node server/app.js'.
2016-12-25T12:20:19.739294+00:00 app[web.1]: npm ERR! Exit status 255
2016-12-25T12:20:19.739443+00:00 app[web.1]: npm ERR!
2016-12-25T12:20:19.739697+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-12-25T12:20:19.739824+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the testfullstack package,
2016-12-25T12:20:19.740093+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-12-25T12:20:19.739951+00:00 app[web.1]: npm ERR! not with npm itself.
2016-12-25T12:20:19.740222+00:00 app[web.1]: npm ERR! node server/app.js
2016-12-25T12:20:19.740362+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-12-25T12:20:19.740452+00:00 app[web.1]: npm ERR! npm bugs testfullstack
2016-12-25T12:20:19.740570+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-12-25T12:20:19.740700+00:00 app[web.1]: npm ERR! npm owner ls testfullstack
2016-12-25T12:20:19.741006+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-12-25T12:20:19.746333+00:00 app[web.1]:
2016-12-25T12:20:19.746571+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-12-25T12:20:19.746693+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-12-25T12:20:19.818450+00:00 heroku[web.1]: Process exited with status 1
2016-12-25T12:20:19.827787+00:00 heroku[web.1]: State changed from starting to crashed