首页 > 解决方案 > 使用 npx 运行 create-react-app 的问题

问题描述

当我尝试使用命令运行 create-react-app 时,npx create-react-app 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/

然后,我尝试使用全局卸载 create-react-appnpm uninstall -g create-react-app并再次重新运行 npx 命令,但我仍然收到相同的消息,即我应该全局卸载 create-react-app,即使全局安装的唯一模块是我机器上的 npm

标签: reactjscreate-react-appnpx

解决方案


您首先需要卸载全局安装create-react-app,然后使缓存无效。

相同的命令:npm uninstall -g create-react-app && npm cache clean -f

现在,您可以继续使用以下命令再次创建应用程序:npx create-react-app application-name

这个问题与这个问题类似


推荐阅读