当我尝试使用命令npx create-react-app app运行create-react-app时,我收到了以下消息
You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.3).
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全局卸载create-react-app,并再次运行npx命令,我仍然收到相同的消息,即我应该全局卸载create-react-app,所以全局安装的唯一模块是我的机器上的npm
发布于 2021-04-03 22:28:19
您首先需要卸载全局安装的create-react-app,然后使缓存无效。
相同的命令:npm uninstall -g create-react-app && npm cache clean -f
现在,您可以使用npx create-react-app application-name继续创建应用程序。
这个问题类似于this one。
发布于 2021-04-03 23:26:34
在全局卸载create-react-app之后尝试使用npm cache clean -force命令。
发布于 2021-12-15 12:03:52
希望下面的代码能正常工作:
npx create-react-app@latest my-app
问题(#10601):https://github.com/facebook/create-react-app/issues/10601
https://stackoverflow.com/questions/66932193
复制相似问题