无法使用 npx create-react-app "no longer support global installation of Create React App"

Can't use npx create-react-app "no longer support global installation of Create React App"

我无法使用 create-react-app 创建新的应用程序。 我使用的命令是 npx create-react-app appname --template typescript.

我得到的错误是:

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

我用 npm uninstall -g create-react-app 删除了全局包。然后我检查了

没有全局安装打包的
  1. 运行 npm list -g
  2. 检查文件夹 C:\Users\my-user\AppData\roaming\npm

但是 create-react-app 一直说我已经全局安装了“create-react-app 4.0.3”。

毕竟我用 npm cache clean --force 清理缓存并重新启动计算机,但结果相同。

我在 windows 10、npm 7.18.1 和节点 16.4.0

上运行

我错过了什么?

提前致谢

这也抓住了我。你需要 运行

npx clear-npx-cache

在我的例子中,我使用 yarn 全局安装了旧版本的 create-react-app,只需将其删除即可解决问题。

yarn global remove create-react-app

或者,对于 NPM

npm uninstall -g create-react-app

然后我能够 运行 npx create-react-app my-app 没有问题。