使用最简单的命令create-react-app demo / 创建项目,提示这个信息:
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
接着又用了上面提示的先卸载,但是仍然fail。
又试了:
npx create-react-app demo
npm install -g create-react-app demo
通通失败 so sad!
最后试了:
npx create-react-app@5.0.0 ape --use-npm
成功!!
npx create-react-app@版本号 app-name --use-npm/–use-yarn
即npx create-react-app@版本号(latest) 项目名 使用npm还是yarn
大功告成!