VRMS
VRMS copied to clipboard
ER: Local Dev Environment not responding
Overview
As a developer when I was trying to fire up the local dev environment it's not responding as usual. Instead the frontend doesn't load the contents.
- At first it's not throwing any errors but later on it displayed the below mentioned error message
yarn start
yarn run v1.22.19
$ concurrently "cd backend && npm run start" "cd client && npm run start"
[0]
[0] > [email protected] start
[0] > node server.js
[0]
[1]
[1] > [email protected] start
[1] > dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% react-scripts start
[1]
[1] node:events:491
[1] throw er; // Unhandled 'error' event
[1] ^
[1]
[1] Error: spawn react-scripts ENOENT
[1] at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
[1] at onErrorNT (node:internal/child_process:485:16)
[1] at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1] Emitted 'error' event on ChildProcess instance at:
[1] at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
[1] at onErrorNT (node:internal/child_process:485:16)
[1] at processTicksAndRejections (node:internal/process/task_queues:83:21) {
[1] errno: -2,
[1] code: 'ENOENT',
[1] syscall: 'spawn react-scripts',
[1] path: 'react-scripts',
[1] spawnargs: [ 'start' ]
[1] }
[1] cd client && npm run start exited with code 1
[0] Mongoose connected from runServer() and is listening on 4000
Potential Suggestions
@Spiteless suggested the below solutions
- setting up the local development again
- clearing
yarn cache
- uninstalling the
yarn
and then reinstalling it again
Overview
Seems likem the error is indicating that the node is unable to locate react-scripts
.
When plugging the error into Copilot it sends back
The error message Error: spawn react-scripts ENOENT typically means that the system can't find the react-scripts package, which is a set of scripts from the create-react-app starter kit.
meaning of ENOENT
ENOENT is a standard error code in Unix-like operating systems, and it stands for "Error NO ENTity" or "Error NO ENTry".
Provide Further Info
- Can you also provide us with the results of
pwd
in your terminal before you run yarn start?- Wanting to confirm you're starting from the root. Other resources I've taken a peek at are indicating that this error sometiems come up when the node is run outside the application folder.
- Can you provide us with the results of running the front end and back end separately
- terminal 1
cd backend && yarn start
- terminal 2
cd client && yarn start
- terminal 1
Additional Things to Try
- What happens when you install the app with
npm
instead ofyarn
?
Observations
- It looks like the backend is working from this error code, but from when you and I were troubleshooting the front end seemed to run and the backend wasn't working.
Sorry this is happening, hopefully we can get it resolved soon!
Provide Further Info
Can you also provide us with the results of
pwd
in your terminal before you run yarn start?
- Wanting to confirm you're starting from the root. Other resources I've taken a peek at are indicating that this error sometiems come up when the node is run outside the application folder.
Can you provide us with the results of running the front end and back end separately
- terminal 1
cd backend && yarn start
- terminal 2
cd client && yarn start
Additional Things to Try
- What happens when you install the app with
npm
instead ofyarn
?
- The result of
pwd
:
freaky4wrld@Admins-MacBook-Air VRMS % pwd
/Users/freaky4wrld/hfla/VRMS
- result from frontend
freaky4wrld@Admins-MacBook-Air VRMS % cd client
freaky4wrld@Admins-MacBook-Air client % yarn start
zsh: command not found: yarn
freaky4wrld@Admins-MacBook-Air client % nvm use 16
Now using node v16.20.2 (npm v8.19.4)
freaky4wrld@Admins-MacBook-Air client % yarn start
yarn run v1.22.22
$ dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% react-scripts start
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn react-scripts ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn react-scripts',
path: 'react-scripts',
spawnargs: [ 'start' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
- result from backend
reaky4wrld@Admins-MacBook-Air VRMS % cd backend
freaky4wrld@Admins-MacBook-Air backend % yarn start
zsh: command not found: yarn
freaky4wrld@Admins-MacBook-Air backend % nvm use 16
Now using node v16.20.2 (npm v8.19.4)
freaky4wrld@Admins-MacBook-Air backend % yarn start
yarn run v1.22.22
$ node server.js
Mongoose connected from runServer() and is listening on 4000
Things to notice while troubleshooting
- I saw a solution to look into the
client/node_modules
directory for thereact-scripts
and I didn't find it
freaky4wrld@Admins-MacBook-Air client % ls node_modules/react-scripts
ls: node_modules/react-scripts: No such file or directory
Team reported Dev Environment is working again, closing as completed