我能够运行create-react-app来创建成功的测试器react文件。但是,当我尝试使用“npm start”运行任何react文件时,出现以下错误:

> react-scripts 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! react1-complete-guide--scripts-version@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the react1-complete-guide--scripts-version@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
我尝试将HOST =“localhost”放入,但我认为我已正确删除了节点模块文件夹,但仍然没有成功。有人可以提供一些指导/命令来帮助您吗?非常感谢!

最佳答案

看来npm在依赖项中找不到react-scripts
尝试删除node_modules文件夹中的所有内容,然后删除package-lock.json文件。然后运行npm install以重新安装所有依赖项。

关于reactjs - 在Mac上成功运行react时出错: ELIFECYCLE, spawn, ENOENT,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62581104/

10-16 23:48