npm start error with create-react-app
Author of Create React App checking in.
You absolutely should not be installing react-scripts
globally.
You also don't need ./node_modules/react-scripts/bin/
in package.json
as this answer implies.
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.
I suggest doing these three steps:
npm install -g npm@latest
to update npm because it is sometimes buggy.rm -rf node_modules
to remove the existing modules.npm install
to re-install the project dependencies.
This should fix the problem.
If it doesn't, please file an issue with a link to your project and versions of Node and npm.
It seems like you don't have react-scripts
in your global environment.Two possibility are available here :
npm install -g react-scripts
or in your package.json change your script part like this :
"scripts": { "start": "./node_modules/react-scripts/bin/react-scripts.js start", "start:prod": "pushstate-server build", "build": "./node_modules/react-scripts/bin/react-scripts.js build", "test": "./node_modules/react-scripts/bin/react-scripts.js test --env=jsdom", "eject": "./node_modules/react-scripts/bin/react-scripts.js eject", "server": "cd client/api && pm2 start server.js --watch", "proxy": "http://128.199.139.144:3000" },
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