Closed freaky4wrld closed 4 months ago
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".
pwd
in your terminal before you run yarn start?
cd backend && yarn start
cd client && yarn start
npm
instead of yarn
?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.
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
client/node_modules
directory for the react-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
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.
Potential Suggestions
@Spiteless suggested the below solutions
yarn cache
yarn
and then reinstalling it again