I'm having trouble viewing my Node/Express + React project in Heroku. After successfully pushing my project to Heroku, I get a 404 error page when I try to view my app in heroku.
Heroku Logs shows that the concurrently package was not found
I was wondering if anyone can help me figure out why? Everything works locally. No issues. I haven't been able to find any solutions. I've tried this: https://github.com/RickWong/react-isomorphic-starterkit/issues/12
I tried setting an environment variable in heroku with the following suggestion:
heroku config:set NPM_CONFIG_PRODUCTION=false
However, it did not work.
I also found this:
https://github.com/rickbergfalk/sqlpad/issues/359
I've attempted re-installing concurrently twice, in the server folder, as well as in root. But with each instance, I got the same error telling me that concurrently was not found.
Here is the Heroku log:
2019-01-05T04:44:42.843348+00:00 heroku[web.1]: Starting process with command `npm start`
2019-01-05T04:44:45.795355+00:00 heroku[web.1]: Process exited with status 1
2019-01-05T04:44:45.817371+00:00 heroku[web.1]: State changed from starting to crashed
2019-01-05T04:44:45.825275+00:00 heroku[web.1]: State changed from crashed to starting
2019-01-05T04:44:45.691080+00:00 app[web.1]:
2019-01-05T04:44:45.691107+00:00 app[web.1]: > [email protected] start /app
2019-01-05T04:44:45.691110+00:00 app[web.1]: > concurrently -- kill-others "npm run server" "npm run client"
2019-01-05T04:44:45.691112+00:00 app[web.1]:
2019-01-05T04:44:45.699841+00:00 app[web.1]: sh: 1: concurrently: not found
2019-01-05T04:44:45.704281+00:00 app[web.1]: npm ERR! file sh
2019-01-05T04:44:45.704664+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-01-05T04:44:45.704985+00:00 app[web.1]: npm ERR! errno ENOENT
2019-01-05T04:44:45.705300+00:00 app[web.1]: npm ERR! syscall spawn
2019-01-05T04:44:45.706913+00:00 app[web.1]: npm ERR! [email protected] start: `concurrently -- kill-others "npm run server" "npm run client"`
2019-01-05T04:44:45.707140+00:00 app[web.1]: npm ERR! spawn ENOENT
2019-01-05T04:44:45.707475+00:00 app[web.1]: npm ERR!
2019-01-05T04:44:45.707708+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2019-01-05T04:44:45.708000+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-01-05T04:44:45.718125+00:00 app[web.1]:
2019-01-05T04:44:45.718481+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-01-05T04:44:45.718674+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-01-05T04_44_45_709Z-debug.log
Any suggestions?
(Not sure this matters, but my dev environment is in ubuntu, which I'm running inside virtualbox; host os is Windows 8)
I found a solution to my problem.
After struggling with it, I decided to just start over and build a sample react/express app, and see if I could deploy it to heroku. Upon successfully deploying, I compared the code from my sample app and my broken app. It then occurred to me that perhaps the issue was with the commands that I assigned to the heroku-postbuild script in the package.json file of my root folder.
Previously, I had this junk:
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
I changed that to this:
"heroku-postbuild": "cd client && npm install && npm run build"
And, like magic, it worked! I guess I wasn't "building" what I was supposed to build on the heroku side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With