LATEST EDIT: I added react-scripts under dependencies in package.json for the 'root'/backend and pushed to heroku and that seems to have solved the issue. However, I am now having getting a new problem regarding the port.
On the development side of things, I did make use of a setupProxy.js file in the client folder so that calls to port:3000 (front end) would go to port:2020 (back end). Could that be causing an issue now that it's deployed on heroku?
2020-07-13T21:16:33.712913+00:00 app[web.1]: [1] > react-scripts start
2020-07-13T21:16:33.712914+00:00 app[web.1]: [1]
2020-07-13T21:16:34.489638+00:00 heroku[web.1]: State changed from starting to up
2020-07-13T21:16:35.092481+00:00 app[web.1]: [0] Connected to MongoDB.
2020-07-13T21:16:36.243148+00:00 app[web.1]: [1] Something is already running on port 59821.
2020-07-13T21:16:36.288193+00:00 app[web.1]: [1] npm run client exited with code 0
Original:
I had an old local full stack MERN project that I wanted to play around with and get deployed on Heroku. After a quick and dirty adjustment to the package.json start script and pushing to Heroku, it seems that the client code has an issue running while the back end goes up just fine.
Now, the project is structured a bit strangely: At the top is the root project directory, one level under has the backend code. Also one level under the root is a client folder, which inside has all the React code.
May I please get some help regarding the client code not running? What's up with react-scripts not being found?
package.json:
"scripts": {
"start": "concurrently \"npm run server \" \"npm run client\" ",
"server": "node index.js",
"client": "npm run start --prefix client",
Heroku logs:
2020-07-13T21:01:07.720727+00:00 heroku[web.1]: Starting process with command `npm start`
2020-07-13T21:01:10.020675+00:00 app[web.1]:
2020-07-13T21:01:10.020716+00:00 app[web.1]: > travellogger@1.0.0 start /app
2020-07-13T21:01:10.020717+00:00 app[web.1]: > concurrently "npm run server " "npm run client"
2020-07-13T21:01:10.020718+00:00 app[web.1]:
2020-07-13T21:01:10.874136+00:00 app[web.1]: [1]
2020-07-13T21:01:10.874171+00:00 app[web.1]: [1] > travellogger@1.0.0 client /app
2020-07-13T21:01:10.874172+00:00 app[web.1]: [1] > npm run start --prefix client
2020-07-13T21:01:10.874173+00:00 app[web.1]: [1]
2020-07-13T21:01:10.916007+00:00 app[web.1]: [0]
2020-07-13T21:01:10.916009+00:00 app[web.1]: [0] > travellogger@1.0.0 server /app
2020-07-13T21:01:10.916013+00:00 app[web.1]: [0] > node index.js
2020-07-13T21:01:10.916014+00:00 app[web.1]: [0]
2020-07-13T21:01:11.208139+00:00 app[web.1]: [1]
2020-07-13T21:01:11.208156+00:00 app[web.1]: [1] > client@0.1.0 start /app/client
2020-07-13T21:01:11.208157+00:00 app[web.1]: [1] > react-scripts start
2020-07-13T21:01:11.208157+00:00 app[web.1]: [1]
2020-07-13T21:01:11.216203+00:00 app[web.1]: [1] sh: 1: react-scripts: not found
2020-07-13T21:01:11.220328+00:00 app[web.1]: [1] npm ERR! code ELIFECYCLE
2020-07-13T21:01:11.220330+00:00 app[web.1]: [1] npm ERR! syscall spawn
2020-07-13T21:01:11.220330+00:00 app[web.1]: [1] npm ERR! file sh
2020-07-13T21:01:11.220330+00:00 app[web.1]: [1] npm ERR! errno ENOENT
2020-07-13T21:01:11.221626+00:00 app[web.1]: [1] npm ERR! client@0.1.0 start: `react-scripts start`
2020-07-13T21:01:11.221627+00:00 app[web.1]: [1] npm ERR! spawn ENOENT
2020-07-13T21:01:11.221628+00:00 app[web.1]: [1] npm ERR!
2020-07-13T21:01:11.221629+00:00 app[web.1]: [1] npm ERR! Failed at the client@0.1.0 start script.
2020-07-13T21:01:11.221629+00:00 app[web.1]: [1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-07-13T21:01:11.229296+00:00 app[web.1]: [1] npm WARN Local package.json exists, but node_modules missing, did you mean to install?
2020-07-13T21:01:11.229779+00:00 app[web.1]: [1]
2020-07-13T21:01:11.229780+00:00 app[web.1]: [1] npm ERR! A complete log of this run can be found in:
2020-07-13T21:01:11.229781+00:00 app[web.1]: [1] npm ERR! /app/.npm/_logs/2020-07-13T21_01_11_221Z-debug.log
2020-07-13T21:01:11.236323+00:00 app[web.1]: [1] npm ERR! code ELIFECYCLE
2020-07-13T21:01:11.236324+00:00 app[web.1]: [1] npm ERR! errno 1
2020-07-13T21:01:11.237379+00:00 app[web.1]: [1] npm ERR! travellogger@1.0.0 client: `npm run start --prefix client`
2020-07-13T21:01:11.237380+00:00 app[web.1]: [1] npm ERR! Exit status 1
2020-07-13T21:01:11.237380+00:00 app[web.1]: [1] npm ERR!
2020-07-13T21:01:11.237381+00:00 app[web.1]: [1] npm ERR! Failed at the travellogger@1.0.0 client script.
2020-07-13T21:01:11.237381+00:00 app[web.1]: [1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-07-13T21:01:11.244959+00:00 app[web.1]: [1]
2020-07-13T21:01:11.245780+00:00 app[web.1]: [1] npm ERR! A complete log of this run can be found in:
2020-07-13T21:01:11.245781+00:00 app[web.1]: [1] npm ERR! /app/.npm/_logs/2020-07-13T21_01_11_238Z-debug.log
2020-07-13T21:01:11.250405+00:00 app[web.1]: [1] npm run client exited with code 1
2020-07-13T21:01:12.132156+00:00 heroku[web.1]: State changed from starting to up
2020-07-13T21:01:12.342170+00:00 app[web.1]: [0] Connected to MongoDB.