我按照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.有人能解释一下是怎么回事吗?该怎么做才能修复呢?
谢谢
发布于 2019-02-15 19:18:35
npm install中存在一些问题,无法完成react脚本的安装。遵循下面这些简单的步骤就可以让它工作。
它现在应该可以工作了。
发布于 2020-03-24 12:53:26
反应脚本运行"npm install -g -scripts“。这在您试图运行的文件夹之外。这将导致命令在内部被识别。
发布于 2021-10-20 10:46:08
我注意到的是,如果你经常切换包的版本,这个问题就会弹出来。主要是缓存问题。并将通过执行以下步骤来解决:
删除终端目录,以便获得packages
node_modules的最新副本或清除缓存,我们需要在package-lock.json中运行npm cache clean --force命令。PS: clean -->删除本地缓存文件夹中的所有数据并运行npm i或yarn
https://stackoverflow.com/questions/52823393
复制相似问题