react项目搭建以及npm start 报错解决(mac环境下)

1、安装node、webpack

2、

sudo npm i create-react-app

3、

create-react-app my_react(项目名) --offline

4、

npm start

报错:

The react-scripts package provided by Create React App requires a dependency:

  "babel-loader": "8.0.5"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:

  /Users/panqi/node_modules/babel-loader (version: 8.0.6) 

解决(全局卸载再安装):

npm uninstall babel-loader
npm i [email protected]

npm start 再报错:

The react-scripts package provided by Create React App requires a dependency:

  "webpack": "4.29.6"

Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:

  /Users/panqi/node_modules/webpack (version: 4.35.0)

解决(全局卸载再安装):

npm uninstall webpack
npm install [email protected]

npm start 后解决此问题。

你可能感兴趣的:(react)