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

其他回答

刚刚在安装material-ui后遇到了这个问题。

通过再次运行npm install解决了这个问题。

https://github.com/facebookincubator/create-react-app

npm install -g create-react-app

create-react-app my-app
cd my-app/
npm start

全局安装create-react-app包。 然后运行它并创建一个名为my-app的项目。 进入你的项目文件夹,然后运行npm start。如果不行,试试运行npm install,然后运行npm start。如果这不能很好地工作,尝试更新你的节点版本和/或npm。

安装Yarn就解决了我的问题

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

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

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

sudo npm install -g yarn

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