即使在更新包后,安装 create-react-app 包时仍然出现此错误
2021-12-22
488
npx create-react-app my-app
Need to install the following packages:
create-react-app
Ok to proceed? (y)
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/
2个回答
正如错误中所说,您需要删除 create-react-app 的全局安装,因此根据您使用的是 npm 还是 yarn 运行这两个命令:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
完成后,再次打开目录中的终端并使用 npx 命令。它应该可以解决问题。
npx create-react-app my-app
e.a.
2021-12-22
正如本 帖子 中提到的,尝试删除 npx 缓存
npx clear-npx-cache
Rok
2022-01-04