I have a project who I didn\'t touch for 2 weeks. I take it back and now when I try to run npm start
I got this error.
> react-scripts start
As Dan said correctly,
If you see this:
npm ERR! UpScore@0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT
It just means something went wrong when dependencies were installed the first time.
But I got something slightly different because running npm install -g npm@latest
to update npm might sometimes leave you with this error:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for npm@lates
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
so, instead of running npm install -g npm@latest
, I suggest running the below steps:
npm i -g npm //which will also update npm
rm -rf node_modules/ && npm cache clean // to remove the existing modules and clean the cache.
npm install //to re-install the project dependencies.
This should get you back on your feet.
This occurs when the node_modules gets out of sync with package.json.
Run the following at the root and any sub service /sub-folder that might have node_modules folder within it.
rd node_modules /S /Q
npm install
Yes you should not install react-scripts globally, it will not work.
I think i didn't use the --save when i first created the project (on another machine), so for me this fixed the problem :
npm install --save react react-dom react-scripts
incase you happened to be so unlucky like me that spent three(3) days in a row trying to solve this problem every solution proposed here failed me ... create a .env file in your project root and add this code SKIP_PREFLIGHT_CHECK=true
. Good luck
It occurred to me but none of the above worked.
events.js:72
throw er; // Unhandled 'error' event
^
npm ERR! UpScore@0.6.0 start: `react-scripts start`
npm ERR! spawn ENOENT
Error: spawn ENOENT
at errnoException (child_process.js:1000:11)
at Process.ChildProcess._handle.onexit (child_process.js:791:34)
This happens because you might have installed react-scripts
globally.
To make this work...
C:\Users\<USER>\AppData\Roaming
node_modules
foldernpm install
to install the dependencies (delete package-lock.json if its already created)npm install --save react react-dom react-scripts
npm start
This should get you back on track... Happy Coding
My issue was stemming from permission issues. I solved mine by following this https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally