首页 > 解决方案 > npm start 突然停止在 react 应用程序上工作

问题描述

我已经学习了大约两周的反应,突然 npm start 无法运行。这就是我得到的:

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

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Michelle/.npm/_logs/2020-07-29T14_35_20_988Z-debug.log

经过大量谷歌搜索后,我尝试 npm install -g npm@latest了但许可被拒绝。

多次删除并重新安装节点,尝试使用 Homebrew 等,但没有任何效果。

编辑:找到解决方案!Npm 找不到 react-scripts,所以我不得不将脚本更改package.json"start": "node_modules/react-scripts/bin/react-scripts.js start".

标签: reactjsnpm

解决方案


您需要安装反应脚本

npm install react-scripts

推荐阅读