hackforla / VRMS

Volunteer Relationship Management System: This is an ambitious project to create a system that will help us measure our human capital development, reduce repetitive tasks and processes, and improve outcomes.
GNU Affero General Public License v3.0
39 stars 75 forks source link

ER: Local Dev Environment not responding #1633

Closed freaky4wrld closed 4 months ago

freaky4wrld commented 5 months ago

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.

yarn start
yarn run v1.22.19
$ concurrently "cd backend && npm run start" "cd client && npm run start"
[0] 
[0] > vrms-server@0.3.0 start
[0] > node server.js
[0] 
[1] 
[1] > vrms-client@0.3.0 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

trillium commented 4 months ago

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

Additional Things to Try

Observations


Sorry this is happening, hopefully we can get it resolved soon!

freaky4wrld commented 4 months ago

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 of yarn ?
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

Things to notice while troubleshooting

freaky4wrld@Admins-MacBook-Air client % ls node_modules/react-scripts
ls: node_modules/react-scripts: No such file or directory
JackHaeg commented 4 months ago

Team reported Dev Environment is working again, closing as completed