我正在使用 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
之后:
npm 缓存清理 --force
npm 缓存验证
npx clear-npx-cache
清除您的 npx 缓存。npx create-react-app your-app
或 npx create-react-app@latest my-app --use-npm
关于reactjs - 为什么 npm uninstall -g create-react-app 失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70446569/
相关文章:
amazon-web-services - AWS S3 : Why Public object d
nuget - nuget 的 GitHub Packages 服务身份验证问题
javascript - 如何在项目的特定子目录上运行 prettier?
rust - @ operator bindings over extra conditionals
vue.js - 有没有办法在 Vue 3 Composition API 中的随机组件之间共享 r
typescript - TypeScript 中的泛型类型参数 T 是什么?