我遵循 udemy 课程,使用create-react-app,然后使用npm start. 它工作正常,直到我安装react-router-dom然后我在终端中收到此错误:
react-scripts' is not recognized as an internal or external command, operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! venue@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the venue@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下这是怎么回事吗?以及如何修复它?
谢谢
小智 12
有一些问题npm install无法完成 React 脚本的安装。按照这些简单的步骤来让它工作。
npm installnpm i -S react-scriptsnpm start它现在应该可以工作了。
我注意到,如果您频繁切换软件包的版本,就会出现此问题。主要是缓存问题。并通过执行以下步骤解决:
node_modules目录,以便我们获得软件包的新副本package-lock.json或yarn.locknpm cache clean --force在终端中运行命令。PS: clean --> 删除本地缓存文件夹中的所有数据npm i或yarn| 归档时间: |
|
| 查看次数: |
13968 次 |
| 最近记录: |