Error when deploying Express.js + React.js project to heroku - node.js

I finished working on my website, and everything works great locally, but I get an error when deploying to heroku.
Some background:
Back-end server was built using this tutorial (Express.js + Sequelize + PostgreSQL): https://www.djamware.com/post/5b56a6cc80aca707dd4f65a9/nodejs-expressjs-sequelizejs-and-postgresql-restful-api
Front-end was built by using npx create-react-app command.
Deploying issue
Now, for deploying I used the tutorial at https://www.freecodecamp.org/news/deploy-a-react-node-app-to/ and created a new Postgres Database on heroku (and that's it).
When I try to view the site at "xxxxx.herokuapp.com" this "Application error" message:
So i tried running the heroku logs --tail command and this was the message I got:
heroku logs --tail -a grades-il
2020-10-09T15:26:15.091358+00:00 heroku[web.1]: Starting process with command `npm start`
2020-10-09T15:26:17.586004+00:00 heroku[web.1]: Process exited with status 1
2020-10-09T15:26:17.623057+00:00 heroku[web.1]: State changed from starting to crashed
2020-10-09T15:26:17.333545+00:00 app[web.1]:
2020-10-09T15:26:17.333566+00:00 app[web.1]: > node-sequelize#0.0.0 start /app
2020-10-09T15:26:17.333567+00:00 app[web.1]: > node ./bin/www
2020-10-09T15:26:17.333567+00:00 app[web.1]:
2020-10-09T15:26:17.505070+00:00 app[web.1]: internal/modules/cjs/loader.js:834
2020-10-09T15:26:17.505072+00:00 app[web.1]: throw err;
2020-10-09T15:26:17.505072+00:00 app[web.1]: ^
2020-10-09T15:26:17.505072+00:00 app[web.1]:
2020-10-09T15:26:17.505073+00:00 app[web.1]: Error: Cannot find module './school'
2020-10-09T15:26:17.505073+00:00 app[web.1]: Require stack:
2020-10-09T15:26:17.505073+00:00 app[web.1]: - /app/controllers/index.js
2020-10-09T15:26:17.505074+00:00 app[web.1]: - /app/routes/index.js
2020-10-09T15:26:17.505074+00:00 app[web.1]: - /app/app.js
2020-10-09T15:26:17.505074+00:00 app[web.1]: - /app/bin/www
2020-10-09T15:26:17.505075+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
2020-10-09T15:26:17.505075+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-10-09T15:26:17.505075+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:903:19)
2020-10-09T15:26:17.505075+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Object.<anonymous> (/app/controllers/index.js:1:16)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
2020-10-09T15:26:17.505077+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-10-09T15:26:17.505077+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:903:19) {
2020-10-09T15:26:17.505077+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-10-09T15:26:17.505077+00:00 app[web.1]: requireStack: [
2020-10-09T15:26:17.505078+00:00 app[web.1]: '/app/controllers/index.js',
2020-10-09T15:26:17.505078+00:00 app[web.1]: '/app/routes/index.js',
2020-10-09T15:26:17.505078+00:00 app[web.1]: '/app/app.js',
2020-10-09T15:26:17.505079+00:00 app[web.1]: '/app/bin/www'
2020-10-09T15:26:17.505079+00:00 app[web.1]: ]
2020-10-09T15:26:17.505079+00:00 app[web.1]: }
2020-10-09T15:26:17.515720+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-10-09T15:26:17.515920+00:00 app[web.1]: npm ERR! errno 1
2020-10-09T15:26:17.520600+00:00 app[web.1]: npm ERR! node-sequelize#0.0.0 start: `node ./bin/www`
2020-10-09T15:26:17.520705+00:00 app[web.1]: npm ERR! Exit status 1
2020-10-09T15:26:17.520815+00:00 app[web.1]: npm ERR!
2020-10-09T15:26:17.520929+00:00 app[web.1]: npm ERR! Failed at the node-sequelize#0.0.0 start script.
2020-10-09T15:26:17.521011+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-09T15:26:17.525367+00:00 app[web.1]:
2020-10-09T15:26:17.525509+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-10-09T15:26:17.525583+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-10-09T15_26_17_521Z-debug.log
2020-10-09T15:27:20.340920+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxx.herokuapp.com request_id=320b7a37-e1e9-4974-92b0-b98e6af2667a fwd="79.177.39.29" dyno= connect= service= status=503 bytes= protocol=http
2020-10-09T15:27:20.850485+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxxx.herokuapp.com request_id=23268c05-28cf-4fc4-9aa7-8ef69befa2b2 fwd="79.177.39.29" dyno= connect= service= status=503 bytes= protocol=http
So if you have any idea how to fix this, I'd appreciate your help.
Thanks!

Thanks to Mohit Karekar I solved the problem by just changing
require('./school');
to
require('./School');
and that's it.

Related

I'm trying to deploy my node.js discord bot on heroku but I keep getting errors

I was trying to deploy my discord.js bot on heroku but I always get an error and the bot crashes. I codes are fine, I ran it on my pc and it does not give any errors. I followed this link to set up my heroku app https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up. I did exactly as it said but I get this error:
2021-10-12T08:15:45.604131+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-12T08:15:46.708903+00:00 app[web.1]:
2021-10-12T08:15:46.709032+00:00 app[web.1]: > kurumi#1.0.0 start /app
2021-10-12T08:15:46.709036+00:00 app[web.1]: > node index.js
2021-10-12T08:15:46.709036+00:00 app[web.1]:
2021-10-12T08:15:46.772460+00:00 app[web.1]: /app/node_modules/discord.js/src/rest/APIRequest.js:33
2021-10-12T08:15:46.772464+00:00 app[web.1]: agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
2021-10-12T08:15:46.772465+00:00 app[web.1]: ^^^
2021-10-12T08:15:46.772465+00:00 app[web.1]:
2021-10-12T08:15:46.772468+00:00 app[web.1]: SyntaxError: Unexpected token '??='
2021-10-12T08:15:46.772468+00:00 app[web.1]: at wrapSafe (internal/modules/cjs/loader.js:1001:16)
2021-10-12T08:15:46.772468+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1049:27)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:950:32)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:974:19)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:93:18)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:4:20)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:46.779715+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-12T08:15:46.779895+00:00 app[web.1]: npm ERR! errno 1
2021-10-12T08:15:46.783479+00:00 app[web.1]: npm ERR! kurumi#1.0.0 start: `node index.js`
2021-10-12T08:15:46.783529+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-12T08:15:46.783595+00:00 app[web.1]: npm ERR!
2021-10-12T08:15:46.783640+00:00 app[web.1]: npm ERR! Failed at the kurumi#1.0.0 start script.
2021-10-12T08:15:46.783698+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-12T08:15:46.786955+00:00 app[web.1]:
2021-10-12T08:15:46.787031+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-12T08:15:46.787064+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-12T08_15_46_784Z-debug.log
2021-10-12T08:15:46.938086+00:00 heroku[web.1]: Process exited with status 1
2021-10-12T08:15:47.109411+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-12T08:15:47.120433+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-12T08:15:50.000000+00:00 app[api]: Build succeeded
2021-10-12T08:15:51.902833+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-12T08:15:52.879739+00:00 app[web.1]:
2021-10-12T08:15:52.879754+00:00 app[web.1]: > kurumi#1.0.0 start /app
2021-10-12T08:15:52.879755+00:00 app[web.1]: > node index.js
2021-10-12T08:15:52.879755+00:00 app[web.1]:
2021-10-12T08:15:52.943619+00:00 app[web.1]: /app/node_modules/discord.js/src/rest/APIRequest.js:33
2021-10-12T08:15:52.943621+00:00 app[web.1]: agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
2021-10-12T08:15:52.943621+00:00 app[web.1]: ^^^
2021-10-12T08:15:52.943622+00:00 app[web.1]:
2021-10-12T08:15:52.943622+00:00 app[web.1]: SyntaxError: Unexpected token '??='
2021-10-12T08:15:52.943623+00:00 app[web.1]: at wrapSafe (internal/modules/cjs/loader.js:1001:16)
2021-10-12T08:15:52.943623+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1049:27)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:950:32)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:974:19)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:93:18)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:4:20)
2021-10-12T08:15:52.943627+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-10-12T08:15:52.943627+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:52.950345+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-12T08:15:52.950523+00:00 app[web.1]: npm ERR! errno 1
2021-10-12T08:15:52.953970+00:00 app[web.1]: npm ERR! kurumi#1.0.0 start: `node index.js`
2021-10-12T08:15:52.954012+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-12T08:15:52.954061+00:00 app[web.1]: npm ERR!
2021-10-12T08:15:52.954092+00:00 app[web.1]: npm ERR! Failed at the kurumi#1.0.0 start script.
2021-10-12T08:15:52.954134+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-12T08:15:52.956414+00:00 app[web.1]:
2021-10-12T08:15:52.956490+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-12T08:15:52.956517+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-12T08_15_52_954Z-debug.log
2021-10-12T08:15:53.132196+00:00 heroku[web.1]: Process exited with status 1
2021-10-12T08:15:53.198551+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-12T08:16:14.979868+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-thicket-97709.herokuapp.com request_id=bc0fd458-0a88-4f7f-8fe6-7a21d52e3035 fwd="114.31.4.178" dyno= connect= service= status=503 bytes= protocol=https
2021-10-12T08:16:15.988690+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-thicket-97709.herokuapp.com request_id=b830f6e2-5525-4310-b415-4e902015b8e3 fwd="114.31.4.178" dyno= connect= service= status=503 bytes= protocol=https
Heroku have very low nodejs version and you can't update it sadly, so there is no real way to fix it. You still can run a bot here if it works on djs v12.5.3
You can specify a node version in the package.json with the engines property when using heroku. Can you try setting the version to 15 or higher?
{
"name": "myapp",
"description": "a really cool app",
"version": "1.0.0",
"engines": {
"node": "15.x"
}
}

Application error - I'm getting an error message after deployment to Heroku even though my app works fine in development

I tried to publish my app to Heroku but I got the below error message:
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
I checked the logs and got the below info which I cannot decipher:
(node:40446) SyntaxError Plugin: heroku: /home/me/.local/share/heroku/config.json: Unexpected end of JSON input
module: #oclif/config#1.17.0
task: runHook prerun
plugin: heroku
root: /snap/heroku/4076
See more details with DEBUG=*
2021-09-20T22:05:15.905073+00:00 app[api]: Deploy 17474356 by user me.me#myemail.com
2021-09-20T22:05:15.922889+00:00 app[api]: Scaled to web#1:Free by user me.me#myemail.com
2021-09-20T22:05:17.000000+00:00 app[api]: Build succeeded
2021-09-20T22:05:22.406972+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-20T22:05:23.782304+00:00 app[web.1]:
2021-09-20T22:05:23.782323+00:00 app[web.1]: > contact-keeper#1.0.0 start /app
2021-09-20T22:05:23.782323+00:00 app[web.1]: > node server.js
2021-09-20T22:05:23.782323+00:00 app[web.1]:
2021-09-20T22:05:24.264339+00:00 app[web.1]: /app/server.js:4
2021-09-20T22:05:24.264356+00:00 app[web.1]: const path = requier("path");
2021-09-20T22:05:24.264357+00:00 app[web.1]: ^
2021-09-20T22:05:24.264357+00:00 app[web.1]:
2021-09-20T22:05:24.264358+00:00 app[web.1]: ReferenceError: requier is not defined
2021-09-20T22:05:24.264358+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2021-09-20T22:05:24.264359+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-20T22:05:24.264359+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-20T22:05:24.264360+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-20T22:05:24.264360+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-20T22:05:24.264360+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-09-20T22:05:24.264361+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2021-09-20T22:05:24.276266+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-20T22:05:24.276629+00:00 app[web.1]: npm ERR! errno 1
2021-09-20T22:05:24.285403+00:00 app[web.1]: npm ERR! contact-keeper#1.0.0 start: `node server.js`
2021-09-20T22:05:24.285546+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-20T22:05:24.285701+00:00 app[web.1]: npm ERR!
2021-09-20T22:05:24.285813+00:00 app[web.1]: npm ERR! Failed at the contact-keeper#1.0.0 start script.
2021-09-20T22:05:24.285905+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-20T22:05:24.304319+00:00 app[web.1]:
2021-09-20T22:05:24.307416+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-20T22:05:24.307459+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-20T22_05_24_286Z-debug.log
2021-09-20T22:05:24.477472+00:00 heroku[web.1]: Process exited with status 1
2021-09-20T22:05:24.608841+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-20T22:05:24.616776+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-20T22:05:30.615650+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-20T22:05:32.154416+00:00 app[web.1]:
2021-09-20T22:05:32.154432+00:00 app[web.1]: > contact-keeper#1.0.0 start /app
2021-09-20T22:05:32.154432+00:00 app[web.1]: > node server.js
2021-09-20T22:05:32.154433+00:00 app[web.1]:
2021-09-20T22:05:32.491951+00:00 app[web.1]: /app/server.js:4
2021-09-20T22:05:32.491970+00:00 app[web.1]: const path = requier("path");
2021-09-20T22:05:32.491970+00:00 app[web.1]: ^
2021-09-20T22:05:32.491970+00:00 app[web.1]:
2021-09-20T22:05:32.491971+00:00 app[web.1]: ReferenceError: requier is not defined
2021-09-20T22:05:32.491971+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2021-09-20T22:05:32.491971+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-20T22:05:32.491972+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-20T22:05:32.491972+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-20T22:05:32.491972+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-20T22:05:32.491975+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-09-20T22:05:32.491975+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2021-09-20T22:05:32.502469+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-20T22:05:32.504151+00:00 app[web.1]: npm ERR! errno 1
2021-09-20T22:05:32.507359+00:00 app[web.1]: npm ERR! contact-keeper#1.0.0 start: `node server.js`
2021-09-20T22:05:32.507361+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-20T22:05:32.507362+00:00 app[web.1]: npm ERR!
2021-09-20T22:05:32.507362+00:00 app[web.1]: npm ERR! Failed at the contact-keeper#1.0.0 start script.
2021-09-20T22:05:32.507363+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-20T22:05:32.517624+00:00 app[web.1]:
2021-09-20T22:05:32.517629+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-20T22:05:32.517630+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-20T22_05_32_508Z-debug.log
2021-09-20T22:05:32.654009+00:00 heroku[web.1]: Process exited with status 1
2021-09-20T22:05:32.790052+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-20T22:10:11.627061+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-thicket-06601.herokuapp.com request_id=0c6e85f7-f539-406d-a7fa-9d92a88ea7de fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:10:12.524329+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pure-thicket-06601.herokuapp.com request_id=c9282c5e-54aa-4735-802d-fd782041837a fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:13:28.000000+00:00 app[api]: Build started by user me.me#myemail.com
2021-09-20T22:15:44.820687+00:00 app[api]: Deploy d8ef6129 by user me.me#myemail.com
2021-09-20T22:15:44.820687+00:00 app[api]: Release v4 created by user me.me#myemail.com
2021-09-20T22:15:45.198887+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-20T22:15:46.000000+00:00 app[api]: Build succeeded
2021-09-20T22:15:51.404944+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-20T22:15:52.687305+00:00 app[web.1]:
2021-09-20T22:15:52.687323+00:00 app[web.1]: > contact-keeper#1.0.0 start /app
2021-09-20T22:15:52.687323+00:00 app[web.1]: > node server.js
2021-09-20T22:15:52.687324+00:00 app[web.1]:
2021-09-20T22:15:53.120246+00:00 app[web.1]: /app/server.js:4
2021-09-20T22:15:53.120260+00:00 app[web.1]: const path = requier("path");
2021-09-20T22:15:53.120260+00:00 app[web.1]: ^
2021-09-20T22:15:53.120261+00:00 app[web.1]:
2021-09-20T22:15:53.120262+00:00 app[web.1]: ReferenceError: requier is not defined
2021-09-20T22:15:53.120262+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2021-09-20T22:15:53.120263+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-20T22:15:53.120263+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-20T22:15:53.120264+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-20T22:15:53.120264+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-20T22:15:53.120265+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-09-20T22:15:53.120265+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2021-09-20T22:15:53.132041+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-20T22:15:53.132277+00:00 app[web.1]: npm ERR! errno 1
2021-09-20T22:15:53.143479+00:00 app[web.1]: npm ERR! contact-keeper#1.0.0 start: `node server.js`
2021-09-20T22:15:53.143539+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-20T22:15:53.143612+00:00 app[web.1]: npm ERR!
2021-09-20T22:15:53.143669+00:00 app[web.1]: npm ERR! Failed at the contact-keeper#1.0.0 start script.
2021-09-20T22:15:53.143714+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-20T22:15:53.156377+00:00 app[web.1]:
2021-09-20T22:15:53.156477+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-20T22:15:53.156529+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-20T22_15_53_144Z-debug.log
2021-09-20T22:15:53.320983+00:00 heroku[web.1]: Process exited with status 1
2021-09-20T22:15:53.393003+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-20T22:16:11.040791+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-thicket-06601.herokuapp.com request_id=fcca437f-5d66-44db-a8dc-8bb638db78ac fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:16:11.928866+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pure-thicket-06601.herokuapp.com request_id=d12c938a-0a91-4947-8d10-6af6f31a7b9f fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:17:36.704916+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-thicket-06601.herokuapp.com request_id=5ed37742-5272-486e-b762-323e16c53cf1 fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
Any idea what went wrong? Everything worked perfectly fine in localhost but now even locally I'm having problems after deployment.
There is a spelling error. Replace
const path = requier("path");
with
const path = require("path");
and deploy it again to see if it works.

How to find out what's wrong with heroku?

I created a very simple nodejs application, the link is here https://bitbucket.org/danclaudiu95/mongo-nodejs-0.git
I only have an index.js file where I have
router.get('/', (req, res) => {
res.send('Hello World')
})
and commited and pushed changes to heroku, the app is here https://git.heroku.com/nodejs-mongo-cc.git, it tells me "Method Not Allowed"
and here https://nodejs-mongo-cc.herokuapp.com/ is tels Application error
I receive this log when I run heroku logs --tail I have this log
2019-12-08T18:55:25.296312+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-12-08T18:55:25.296314+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-12-08T18:55:25.296316+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2019-12-08T18:55:25.296318+00:00 app[web.1]: }
2019-12-08T18:55:25.304642+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-12-08T18:55:25.305127+00:00 app[web.1]: npm ERR! errno 1
2019-12-08T18:55:25.306936+00:00 app[web.1]: npm ERR! mongo-nodejs-0#1.0.0 start: `node server.js`
2019-12-08T18:55:25.307220+00:00 app[web.1]: npm ERR! Exit status 1
2019-12-08T18:55:25.307516+00:00 app[web.1]: npm ERR!
2019-12-08T18:55:25.307771+00:00 app[web.1]: npm ERR! Failed at the mongo-nodejs-0#1.0.0 start script.
2019-12-08T18:55:25.308011+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-12-08T18:55:25.316870+00:00 app[web.1]:
2019-12-08T18:55:25.317055+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-12-08T18:55:25.317209+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-12-08T18_55_25_308Z-debug.log
2019-12-08T18:55:25.382554+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-08T18:55:25.387301+00:00 heroku[web.1]: State changed from crashed to starting
2019-12-08T18:55:25.361045+00:00 heroku[web.1]: Process exited with status 1
2019-12-08T18:55:26.985866+00:00 heroku[web.1]: Starting process with command `npm start`
2019-12-08T18:55:28.903449+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-08T18:55:28.773773+00:00 app[web.1]:
2019-12-08T18:55:28.773792+00:00 app[web.1]: > mongo-nodejs-0#1.0.0 start /app
2019-12-08T18:55:28.773795+00:00 app[web.1]: > node server.js
2019-12-08T18:55:28.773797+00:00 app[web.1]:
2019-12-08T18:55:28.821433+00:00 app[web.1]: internal/modules/cjs/loader.js:800
2019-12-08T18:55:28.821437+00:00 app[web.1]: throw err;
2019-12-08T18:55:28.821443+00:00 app[web.1]: ^
2019-12-08T18:55:28.821445+00:00 app[web.1]:
2019-12-08T18:55:28.821447+00:00 app[web.1]: Error: Cannot find module 'express'
2019-12-08T18:55:28.821449+00:00 app[web.1]: Require stack:
2019-12-08T18:55:28.821451+00:00 app[web.1]: - /app/server.js
2019-12-08T18:55:28.821452+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
2019-12-08T18:55:28.821454+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:690:27)
2019-12-08T18:55:28.821456+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:852:19)
2019-12-08T18:55:28.821457+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2019-12-08T18:55:28.821459+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:17)
2019-12-08T18:55:28.821460+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:959:30)
2019-12-08T18:55:28.821462+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2019-12-08T18:55:28.821463+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:815:32)
2019-12-08T18:55:28.821465+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:727:14)
2019-12-08T18:55:28.821467+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-12-08T18:55:28.821468+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-12-08T18:55:28.821470+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2019-12-08T18:55:28.821471+00:00 app[web.1]: }
2019-12-08T18:55:28.827415+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-12-08T18:55:28.827775+00:00 app[web.1]: npm ERR! errno 1
2019-12-08T18:55:28.828849+00:00 app[web.1]: npm ERR! mongo-nodejs-0#1.0.0 start: `node server.js`
2019-12-08T18:55:28.829049+00:00 app[web.1]: npm ERR! Exit status 1
2019-12-08T18:55:28.829213+00:00 app[web.1]: npm ERR!
2019-12-08T18:55:28.829353+00:00 app[web.1]: npm ERR! Failed at the mongo-nodejs-0#1.0.0 start script.
2019-12-08T18:55:28.829473+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-12-08T18:55:28.836399+00:00 app[web.1]:
2019-12-08T18:55:28.836520+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-12-08T18:55:28.836621+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-12-08T18_55_28_830Z-debug.log
2019-12-08T18:55:28.884330+00:00 heroku[web.1]: Process exited with status 1
2019-12-08T18:56:13.485700+00:00 app[api]: Release v4 created by user dan_tomuta#yahoo.com
2019-12-08T18:56:13.485700+00:00 app[api]: Set DATABASE_URL config vars by user dan_tomuta#yahoo.com
2019-12-08T18:56:14.534382+00:00 heroku[web.1]: State changed from crashed to starting
2019-12-08T18:56:16.302004+00:00 heroku[web.1]: Starting process with command `npm start`
2019-12-08T18:56:20.368258+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-08T18:56:20.348173+00:00 heroku[web.1]: Process exited with status 1
2019-12-08T18:56:20.213878+00:00 app[web.1]:
2019-12-08T18:56:20.213966+00:00 app[web.1]: > mongo-nodejs-0#1.0.0 start /app
2019-12-08T18:56:20.213969+00:00 app[web.1]: > node server.js
2019-12-08T18:56:20.213972+00:00 app[web.1]:
2019-12-08T18:56:20.279308+00:00 app[web.1]: internal/modules/cjs/loader.js:800
2019-12-08T18:56:20.279312+00:00 app[web.1]: throw err;
2019-12-08T18:56:20.279314+00:00 app[web.1]: ^
2019-12-08T18:56:20.279316+00:00 app[web.1]:
2019-12-08T18:56:20.279318+00:00 app[web.1]: Error: Cannot find module 'express'
2019-12-08T18:56:20.279320+00:00 app[web.1]: Require stack:
2019-12-08T18:56:20.279326+00:00 app[web.1]: - /app/server.js
2019-12-08T18:56:20.279344+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
2019-12-08T18:56:20.279346+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:690:27)
2019-12-08T18:56:20.279349+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:852:19)
2019-12-08T18:56:20.279352+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2019-12-08T18:56:20.279354+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:17)
2019-12-08T18:56:20.279356+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:959:30)
2019-12-08T18:56:20.279359+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2019-12-08T18:56:20.279361+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:815:32)
2019-12-08T18:56:20.279363+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:727:14)
2019-12-08T18:56:20.279365+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-12-08T18:56:20.279367+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-12-08T18:56:20.279369+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2019-12-08T18:56:20.279371+00:00 app[web.1]: }
2019-12-08T18:56:20.284895+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-12-08T18:56:20.285175+00:00 app[web.1]: npm ERR! errno 1
2019-12-08T18:56:20.286349+00:00 app[web.1]: npm ERR! mongo-nodejs-0#1.0.0 start: `node server.js`
2019-12-08T18:56:20.286533+00:00 app[web.1]: npm ERR! Exit status 1
2019-12-08T18:56:20.286713+00:00 app[web.1]: npm ERR!
2019-12-08T18:56:20.286852+00:00 app[web.1]: npm ERR! Failed at the mongo-nodejs-0#1.0.0 start script.
2019-12-08T18:56:20.287001+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-12-08T18:56:20.293863+00:00 app[web.1]:
2019-12-08T18:56:20.294005+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-12-08T18:56:20.294099+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-12-08T18_56_20_287Z-debug.log
2019-12-08T18:59:25.447421+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nodejs-mongo-cc.herokuapp.com request_id=78ed9049-8e85-459d-9579-6a64cdf4a09a fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:26.012326+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nodejs-mongo-cc.herokuapp.com request_id=9f49a46a-ecef-43c3-9f14-e9143c147a5d fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:26.700786+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nodejs-mongo-cc.herokuapp.com request_id=b623338f-0d3d-4ec9-8fa5-6947eaa8ca89 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:27.151441+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nodejs-mongo-cc.herokuapp.com request_id=25967892-0116-4f11-b1e4-fbd051814247 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:28.370508+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nodejs-mongo-cc.herokuapp.com request_id=5627ecd7-98ef-45a1-8475-3b4dfdd91893 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:28.869557+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nodejs-mongo-cc.herokuapp.com request_id=0afb7f92-58ad-4496-84bc-40fc47ebf3b9 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
Can anyone help me, please?
Make sure you follow the guide in the Heroku website for node.js. You can find it here - Getting Started on Heroku with Node.js. Make sure you add a file that has a name Procfile in you project and type in - web: node index.js.
And also do not forget to have a listener in your js file - app.listen(process.env.PORT);.
After you pushed your file from git to Heroku, go to the Heroku website, log in and you will see your app published (might take a while to build).

Why googleapis node module is not found in heroku?

I have a chatbot made using Node Js. It uses "googleapis". It works fine when I create a server from my laptop. But I uploaded files to github and used heroku as server. I get "Application Error" on the web address provided by heroku to access the app. How to fix it.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
2019-11-20T07:55:39.730004+00:00 app[web.1]:
internal/modules/cjs/loader.js:800 2019-11-20T07:55:39.730026+00:00
app[web.1]: throw err; 2019-11-20T07:55:39.730028+00:00 app[web.1]: ^
2019-11-20T07:55:39.730030+00:00 app[web.1]:
2019-11-20T07:55:39.730032+00:00 app[web.1]: Error: Cannot find module
'googleapis' 2019-11-20T07:55:39.730034+00:00 app[web.1]: Require
stack: 2019-11-20T07:55:39.730036+00:00 app[web.1]: - /app/app.js
2019-11-20T07:55:39.730045+00:00 app[web.1]: at
Function.Module._resolveFilename
(internal/modules/cjs/loader.js:797:15)
2019-11-20T07:55:39.730047+00:00 app[web.1]: at Function.Module._load
(internal/modules/cjs/loader.js:690:27)
2019-11-20T07:55:39.730050+00:00 app[web.1]: at Module.require
(internal/modules/cjs/loader.js:852:19)
2019-11-20T07:55:39.730052+00:00 app[web.1]: at require
(internal/modules/cjs/helpers.js:74:18)
2019-11-20T07:55:39.730053+00:00 app[web.1]: at Object.
(/app/app.js:23:16) 2019-11-20T07:55:39.730055+00:00 app[web.1]: at
Module._compile (internal/modules/cjs/loader.js:959:30)
2019-11-20T07:55:39.730057+00:00 app[web.1]: at
Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2019-11-20T07:55:39.730059+00:00 app[web.1]: at Module.load
(internal/modules/cjs/loader.js:815:32)
2019-11-20T07:55:39.730061+00:00 app[web.1]: at Function.Module._load
(internal/modules/cjs/loader.js:727:14)
2019-11-20T07:55:39.730063+00:00 app[web.1]: at
Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-11-20T07:55:39.730065+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-11-20T07:55:39.730067+00:00 app[web.1]: requireStack: [
'/app/app.js' ] 2019-11-20T07:55:39.730069+00:00 app[web.1]: }
2019-11-20T07:55:39.737402+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-11-20T07:55:39.737824+00:00 app[web.1]: npm ERR! errno 1
2019-11-20T07:55:39.739094+00:00 app[web.1]: npm ERR!
messenger-get-started#1.0.0 start: node app.js
2019-11-20T07:55:39.739328+00:00 app[web.1]: npm ERR! Exit status 1
2019-11-20T07:55:39.739554+00:00 app[web.1]: npm ERR!
2019-11-20T07:55:39.739763+00:00 app[web.1]: npm ERR! Failed at the
messenger-get-started#1.0.0 start script.
2019-11-20T07:55:39.739994+00:00 app[web.1]: npm ERR! This is probably
not a problem with npm. There is likely additional logging output
above. 2019-11-20T07:55:39.747500+00:00 app[web.1]:
2019-11-20T07:55:39.747681+00:00 app[web.1]: npm ERR! A complete log
of this run can be found in: 2019-11-20T07:55:39.747852+00:00
app[web.1]: npm ERR!
/app/.npm/_logs/2019-11-20T07_55_39_740Z-debug.log
2019-11-20T07:55:39.842413+00:00 heroku[web.1]: State changed from
starting to crashed 2019-11-20T07:55:39.831194+00:00 heroku[web.1]:
Process exited with status 1 2019-11-20T08:47:20.684024+00:00
heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/" host=mukupukuu.herokuapp.com
request_id=9bf7f838-97ee-4776-9517-b9c0b530241d fwd="49.244.16.204"
dyno= connect= service= status=503 bytes= protocol=https
2019-11-20T08:47:32.344155+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico"
host=mukupukuu.herokuapp.com
request_id=ace83680-39e1-489d-a50c-b1c6811f24ce fwd="49.244.16.204"
dyno= connect= service= status=503 bytes= protocol=https
Make sure to include the GoogleApi npm package in the package.json This helps Heroku fetch and install the required dependencies on the server where your application is deployed.
You can add the package and version manually to package.json
OR
A better alternative is to run npm install --save googleapis

Heroku error code: Elifecycle +more unknowns

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

Resources