简体   繁体   中英

react-scripts: command not found (npm start)

I've been using create-react-app without issues for some time, but recently, after running it, I cannot start the development server. After running npm start , I get the following error:

sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! js-calculator@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the js-calculator@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Scripts appear to be in the correct location and correctly configured in the package.json file. Also, npm start throws me the same error if I run it in other react-apps folders that used to work before. I tried various suggestions I found here on stackoverflow:

  • installing create-react-app globally;
  • reinstalling dependencies ( npm install );
  • reinstalling react scripts ( npm install react-scripts --save );
  • updating node and npm;

but none of the above worked.

Any suggestions? I've also a more detailed .log file, in case anyone wants to have a look at it.

After many tries and more reading of related issues here on SO, I found the cause. One of my react-app parent folders (five levels above) name was " example/example "; naming it to " example-example " solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM