reactjs - 为什么 npm uninstall -g create-react-app 失败

我正在使用 Ubuntu 20.04 机器。

如果我运行 npx create-react-app myapp 系统响应错误:

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/

然后,当我运行 npm uninstall -g create-react-app 时,卸载什么都不做:

xxx@xxx:/prj$ npm uninstall -g create-react-app

up to date, audited 1 package in 307ms

found 0 vulnerabilities

因此,我无法使用 npx 创建新的 React 应用程序。

有什么建议吗?

最佳答案

我遇到了这个问题,这对我有用,在 npm uninstall -g create-react-app 之后:


  1. npm 缓存清理 --force
  2. npm 缓存验证
  3. npx clear-npx-cache 清除您的 npx 缓存。
  4. npx create-react-app your-appnpx create-react-app@latest my-app --use-npm

关于reactjs - 为什么 npm uninstall -g create-react-app 失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70446569/

相关文章:

c++ - 当变量不是局部变量时我应该继续返回吗

amazon-web-services - AWS S3 : Why Public object d

nuget - nuget 的 GitHub Packages 服务身份验证问题

regex - 只查找多行 C 注释,不查找单行 C 注释

javascript - 如何在项目的特定子目录上运行 prettier?

rust - @ operator bindings over extra conditionals

vue.js - 有没有办法在 Vue 3 Composition API 中的随机组件之间共享 r

typescript - TypeScript 中的泛型类型参数 T 是什么?

python - 压缩文件 : Check for correct Password

rust - Substrate - 在此范围内找不到类型 `Vec`