我克隆了一个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,它都不能在任何其他系统上工作。
当前回答
这个变通办法对我很管用
// in your package.json replace
"start": "react-scripts start"
// with:
"start": "node_modules/react-scripts/bin/react-scripts.js start"
其他回答
在包中。json,我改变了
"start": "react-scripts start"
to
"start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start"
我希望这能解决一些人的问题。虽然上面的其他解决方案似乎不适合我。
在发出一个react-scripts构建请求后,我只是随机地遇到了这个“react-scripts: command not found”错误,这在以前工作得很好。
简单地重新启动系统就纠正了这个问题。
这个变通办法对我很管用
// in your package.json replace
"start": "react-scripts start"
// with:
"start": "node_modules/react-scripts/bin/react-scripts.js start"
尝试了上面所有的方法,没有任何工作,所以我使用了npm I react-scripts,它工作了
在花了太多时间尝试以上所有的解决方案后,我可以肯定地说:
如果遇到这个问题,请检查路径。如果路径包含任何特殊字符或空格,只需重命名它,并确保新路径没有任何空格或特殊字符。然后再运行一次。