我克隆了一个react应用程序到我的系统上,并运行以下命令

npm install -g create-react-app
npm install --save react react-dom

之后我就跑了

npm start 

但是它抛出了上面提到的错误,它在我的其他系统上工作得很好,我把它推到了github上。但克隆后,无论是windows还是mac,它都不能在任何其他系统上工作。


当前回答

只需运行这些命令

npm install
npm start

or

yarn start

希望这对你有用 谢谢你!

其他回答

在发出一个react-scripts构建请求后,我只是随机地遇到了这个“react-scripts: command not found”错误,这在以前工作得很好。

简单地重新启动系统就纠正了这个问题。

下面是对我有效的解决方案。尝试用这个命令创建React应用程序。

create-react-app react-app --scripts-version 1.1.5

我在yarn 1.15.1-1的最新版本中遇到了问题

我已经通过降级到低版本sudo apt-get install yarn=1.12.3-1来修复它

在包中。json,我改变了

"start": "react-scripts start"

to

"start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start"

我希望这能解决一些人的问题。虽然上面的其他解决方案似乎不适合我。

这让我一次又一次地感到困惑,当我有一个新的开始创建-反应-应用程序时,请确保你的NODE_ENV变量被设置为开发而不是生产,因为你的包中的devDependencies。NPM install不会安装Json。