![](/img/trans.png)
[英]npm start throws sh: react-scripts: command not found
[英]sh: react-scripts-start: command not found
我有一个无法运行npm start
的项目。
我已经两周没动过这个项目了。 昨天我唯一要做的就是添加一个git存储库,仅此而已。
当我尝试运行npm start
,出现以下错误:
sh: react-scripts-start: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bk-react-replica@0.1.0 start: 'react-scripts-start'
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the bk-react-replica@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
我已经看过其他帖子关于此错误的解决方案,但没有一个适合我。 我已经删除了node_modules
目录和package-lock.json
文件,然后运行npm install
。
但是,我仍然收到相同的错误消息。 有人知道怎么了吗?
这是我的package.json文件:
{
"name": "bk-react-replica",
"version": "0.1.0",
"private": true,
"homepage": "http://qhafeezdomain.dreamhosters.com/projects/bkreplica",
"dependencies": {
"antd": "^3.3.0",
"normalize.css": "^8.0.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-native-scripts": "^1.13.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.2.2",
"react-scripts": "^1.1.4",
"react-scripts-cssmodules": "^1.0.171",
"redux": "^3.7.2"
},
"scripts": {
"start": "react-scripts-start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
当我将您引荐给我提供的类似于您的问题的答案时 ,请运行以下命令:
npm i -g npm //which will update npm
rm -rf node_modules/ && npm cache clean // to remove the existing modules and clean the cache.
npm install //to re-install the project dependencies.
编辑:
我刚刚注意到您的package.json
应该是:
"scripts": {
"start": "react-scripts start",
不
"scripts": {
"start": "react-scripts-start",
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.