隐藏

【开发问题解决】npx create-react-app 无法执行安装的问题处理

发布:2024/11/3 16:06:48作者:管理员 来源:本站 浏览次数:8

在使用npx create-react-app 命令,得到命令行反馈


You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.2).


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/



按照命令行提示执行npm uninstall -g create-react-app进行全局卸载后,再次执行安装依然报错,经过查询,发现需要清理一下npx的缓存,即执行全局卸载命令后,再运行一下命令


npx clear-npx-cache




这时如果命令行提示


Need to install the following packages:

 clear-npx-cache

Ok to proceed? (y)


 


输入y继续安装clear-npx-cache的package包即可


然后再执行react的安装命令npx create-react-app 你的项目名称 即可顺利安装