我克隆了一个react应用程序到我的系统上,并运行以下命令
npm install -g create-react-app
npm install --save react react-dom
之后我就跑了
npm start
但是它抛出了上面提到的错误,它在我的其他系统上工作得很好,我把它推到了github上。但克隆后,无论是windows还是mac,它都不能在任何其他系统上工作。
我克隆了一个react应用程序到我的系统上,并运行以下命令
npm install -g create-react-app
npm install --save react react-dom
之后我就跑了
npm start
但是它抛出了上面提到的错误,它在我的其他系统上工作得很好,我把它推到了github上。但克隆后,无论是windows还是mac,它都不能在任何其他系统上工作。
当前回答
在发出一个react-scripts构建请求后,我只是随机地遇到了这个“react-scripts: command not found”错误,这在以前工作得很好。
简单地重新启动系统就纠正了这个问题。
其他回答
当你用npm Install而不是yarn Install安装包时,这个错误会发生,反之亦然。
你不能在路径中使用空格或特殊字符,例如使用“&”。在我的案例中,我使用了这个路径:“D:\P&D\mern”,因为这个“&”,我浪费了50分钟试图解决这个问题!:/
生活和学习!
我也面临着同样的问题,直到我在Mac终端上运行了这段代码:
sudo npm install -g yarn
显然,我的机器上少了纱线。
对我来说,就是删除包锁。Json和node_modules,然后再次运行NPM install。
这个变通办法对我很管用
// in your package.json replace
"start": "react-scripts start"
// with:
"start": "node_modules/react-scripts/bin/react-scripts.js start"