我克隆了一个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

希望这对你有用 谢谢你!

其他回答

我也面临着同样的问题,直到我在Mac终端上运行了这段代码:

sudo npm install -g yarn

显然,我的机器上少了纱线。

尝试了上面所有的方法,没有任何工作,所以我使用了npm I react-scripts,它工作了

如果你在Docker容器中遇到这个问题,只要确保node_modules没有被添加到.dockerignore文件中。

我有同样的问题sh1:没有找到反应脚本。对我来说,这就是解决方案

这个变通办法对我很管用

// in your package.json replace 
"start": "react-scripts start"

// with:
"start": "node_modules/react-scripts/bin/react-scripts.js start"

对我来说,就是删除包锁。Json和node_modules,然后再次运行NPM install。