-1

I am trying to start my web app via heroku cli. after deploying I try heroku open. when I do, it shows me "Application fail" page where they provide a suggestion for me to run the command heroku logs --tail. I see a long list of executions where the first thing that crashes is the failure to find nodemon

the thing is, I can successfully run nodemon when i npm start locally. the problem happens when i heroku open.

heroku logs --tail results in the following:

2021-10-05T01:56:54.934519+00:00 app[web.1]: 
2021-10-05T01:56:54.938108+00:00 app[web.1]: sh: 1: nodemon: not found
2021-10-05T01:56:54.942920+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-05T01:56:54.943131+00:00 app[web.1]: npm ERR! syscall spawn
2021-10-05T01:56:54.943211+00:00 app[web.1]: npm ERR! file sh
2021-10-05T01:56:54.943308+00:00 app[web.1]: npm ERR! errno ENOENT
2021-10-05T01:56:54.948219+00:00 app[web.1]: npm ERR! detectfaceappapiv1@1.0.0 start: `nodemon server.js`
2021-10-05T01:56:54.948271+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-10-05T01:56:54.948334+00:00 app[web.1]: npm ERR!
2021-10-05T01:56:54.948383+00:00 app[web.1]: npm ERR! Failed at the detectfaceappapiv1@1.0.0 start script.
2021-10-05T01:56:54.948435+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-05T01:56:54.962550+00:00 app[web.1]:
2021-10-05T01:56:54.962668+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-05T01:56:54.962697+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-10-05T01_56_54_949Z-debug.log
2021-10-05T01:56:55.104892+00:00 heroku[web.1]: Process exited with status 1
2021-10-05T01:56:55.183845+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-05T03:15:45.740085+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-05T03:15:47.727415+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-05T03:15:48.650607+00:00 app[web.1]:
2021-10-05T03:15:48.650704+00:00 app[web.1]: > detectfaceappapiv1@1.0.0 start /app
2021-10-05T03:15:48.650706+00:00 app[web.1]: > nodemon server.js
2021-10-05T03:15:48.650707+00:00 app[web.1]:
2021-10-05T03:15:48.662047+00:00 app[web.1]: sh: 1: nodemon: not found
2021-10-05T03:15:48.666240+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-05T03:15:48.666406+00:00 app[web.1]: npm ERR! syscall spawn
2021-10-05T03:15:48.666477+00:00 app[web.1]: npm ERR! file sh
2021-10-05T03:15:48.666556+00:00 app[web.1]: npm ERR! errno ENOENT
2021-10-05T03:15:48.668678+00:00 app[web.1]: npm ERR! detectfaceappapiv1@1.0.0 start: `nodemon server.js`
2021-10-05T03:15:48.668725+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-10-05T03:15:48.668776+00:00 app[web.1]: npm ERR!
2021-10-05T03:15:48.668823+00:00 app[web.1]: npm ERR! Failed at the detectfaceappapiv1@1.0.0 start script.
2021-10-05T03:15:48.668863+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-05T03:15:48.672520+00:00 app[web.1]:
2021-10-05T03:15:48.672592+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-05T03:15:48.672626+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-10-05T03_15_48_669Z-debug.log
2021-10-05T03:15:48.789238+00:00 heroku[web.1]: Process exited with status 1
2021-10-05T03:15:48.830329+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-05T04:54:45.976500+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-05T04:54:48.314500+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-05T04:54:50.071787+00:00 app[web.1]:
2021-10-05T04:54:50.071800+00:00 app[web.1]: > detectfaceappapiv1@1.0.0 start /app
2021-10-05T04:54:50.071801+00:00 app[web.1]: > nodemon server.js
2021-10-05T04:54:50.071801+00:00 app[web.1]:
2021-10-05T04:54:50.079652+00:00 app[web.1]: sh: 1: nodemon: not found
2021-10-05T04:54:50.085454+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-05T04:54:50.085719+00:00 app[web.1]: npm ERR! syscall spawn
2021-10-05T04:54:50.085859+00:00 app[web.1]: npm ERR! file sh
2021-10-05T04:54:50.086080+00:00 app[web.1]: npm ERR! errno ENOENT
2021-10-05T04:54:50.090304+00:00 app[web.1]: npm ERR! detectfaceappapiv1@1.0.0 start: `nodemon server.js`
2021-10-05T04:54:50.090391+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-10-05T04:54:50.090480+00:00 app[web.1]: npm ERR!
2021-10-05T04:54:50.090562+00:00 app[web.1]: npm ERR! Failed at the detectfaceappapiv1@1.0.0 start script.
2021-10-05T04:54:50.090951+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-05T04:54:50.098509+00:00 app[web.1]:
2021-10-05T04:54:50.098701+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-05T04:54:50.098774+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-10-05T04_54_50_092Z-debug.log
2021-10-05T04:54:50.259919+00:00 heroku[web.1]: Process exited with status 1
2021-10-05T04:54:50.632592+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-05T09:12:32.734768+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-05T09:12:35.155424+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-05T09:12:36.467495+00:00 app[web.1]:
2021-10-05T09:12:36.467505+00:00 app[web.1]: > detectfaceappapiv1@1.0.0 start /app
2021-10-05T09:12:36.467505+00:00 app[web.1]: > nodemon server.js
2021-10-05T09:12:36.467506+00:00 app[web.1]:
2021-10-05T09:12:36.477925+00:00 app[web.1]: sh: 1: nodemon: not found
2021-10-05T09:12:36.493189+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-05T09:12:36.493573+00:00 app[web.1]: npm ERR! syscall spawn
2021-10-05T09:12:36.493747+00:00 app[web.1]: npm ERR! file sh
2021-10-05T09:12:36.493936+00:00 app[web.1]: npm ERR! errno ENOENT
2021-10-05T09:12:36.497717+00:00 app[web.1]: npm ERR! detectfaceappapiv1@1.0.0 start: `nodemon server.js`
2021-10-05T09:12:36.498844+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-10-05T09:12:36.498951+00:00 app[web.1]: npm ERR!
2021-10-05T09:12:36.499039+00:00 app[web.1]: npm ERR! Failed at the detectfaceappapiv1@1.0.0 start script.
2021-10-05T09:12:36.499117+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-05T09:12:36.506402+00:00 app[web.1]:
2021-10-05T09:12:36.506477+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-05T09:12:36.506548+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-10-05T09_12_36_500Z-debug.log
2021-10-05T09:12:36.659116+00:00 heroku[web.1]: Process exited with status 1
2021-10-05T09:12:36.751331+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-05T14:43:53.915711+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-05T14:43:56.228553+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-05T14:43:57.534046+00:00 app[web.1]:
2021-10-05T14:43:57.534087+00:00 app[web.1]: > detectfaceappapiv1@1.0.0 start /app
2021-10-05T14:43:57.534092+00:00 app[web.1]: > nodemon server.js
2021-10-05T14:43:57.534092+00:00 app[web.1]:
2021-10-05T14:43:57.549030+00:00 app[web.1]: sh: 1: nodemon: not found
2021-10-05T14:43:57.557412+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-05T14:43:57.557713+00:00 app[web.1]: npm ERR! syscall spawn
2021-10-05T14:43:57.557808+00:00 app[web.1]: npm ERR! file sh
2021-10-05T14:43:57.557992+00:00 app[web.1]: npm ERR! errno ENOENT
2021-10-05T14:43:57.561619+00:00 app[web.1]: npm ERR! detectfaceappapiv1@1.0.0 start: `nodemon server.js`
2021-10-05T14:43:57.561706+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-10-05T14:43:57.561794+00:00 app[web.1]: npm ERR!
2021-10-05T14:43:57.561875+00:00 app[web.1]: npm ERR! Failed at the detectfaceappapiv1@1.0.0 start script.
2021-10-05T14:43:57.561942+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-05T14:43:57.570261+00:00 app[web.1]:
2021-10-05T14:43:57.570325+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-05T14:43:57.570363+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-10-05T14_43_57_563Z-debug.log
2021-10-05T14:43:57.714282+00:00 heroku[web.1]: Process exited with status 1
2021-10-05T14:43:57.777703+00:00 heroku[web.1]: State changed from starting to crashed
leadbassist
  • 165
  • 1
  • 11
  • Does this answer your question? [Need help deploying a RESTful API created with MongoDB Atlas and Express](https://stackoverflow.com/questions/55987475/need-help-deploying-a-restful-api-created-with-mongodb-atlas-and-express) – ChrisGPT was on strike Oct 06 '21 at 02:31

2 Answers2

0

Try changing your procfile to web: node myapp.js. It is also possible webpack is overriding your procfile. Check out the question and answer here: Heroku failing to start my node app because its trying to do it with nodemon

  • thanks for the Procfile idea. My project didn't have one, so I had to create it. Unfortunately, that wasn't enough to fix my issue. – leadbassist Oct 07 '21 at 02:09
0

After endless searching, I found a remedy that worked for me!

I followed the instructions from a youtube video: https://www.youtube.com/watch?v=xxua85cCiT0

  1. create Procfile
  2. make NPM_CONFIG_PRODUCTION=false OR move nodemon package from devDependencies to dependencies.
  3. manually changed port to 8080
leadbassist
  • 165
  • 1
  • 11