sh:react-scripts:运行 npm start 后找不到命令

问题描述:

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

I cloned a react application onto my system and ran following commands

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

在那之后我跑了

npm start 

但是它抛出了上述错误,它在我将它推送到 github 的其他系统上运行良好.但是无论是windows还是mac,克隆后都不能在其他系统上运行.

But it threw the above mentioned error, It is working fine on my other system from which i pushed it on github. But it is not working on any other system after cloning whether windows or mac.

检查 node_modules 目录是否存在.在一个新的克隆之后,很可能没有node_modules(因为这些是.gitignored).

Check if node_modules directory exists. After a fresh clone, there will very likely be no node_modules (since these are .gitignore'd).

运行 npm install(或 yarn)以确保下载所有 deps.

run npm install (or yarn) to ensure all deps are downloaded.

如果node_modules存在,用rm -rf node_modules删除它,然后运行npm install(或yarn).

If node_modules exists, remove it with rm -rf node_modules and then run npm install (or yarn).