您正在运行 `create-react-app` 4.0.3,它落后于最新版本 (5.0.0)。我们不再支持 Create React App 的全局安装

hse*_*hse 25 reactjs redux

C:\Users\lg\Desktop> npm uninstall -g create-react-app

up to date, audited 1 package in 216ms

found 0 vulnerabilities
Run Code Online (Sandbox Code Playgroud)
C:\Users\lg\Desktop>npx clear-npx-cache
Need to install the following packages:
  clear-npx-cache
Ok to proceed? (y) y
Run Code Online (Sandbox Code Playgroud)
C:\Users\lg\Desktop>npx create-react-app@5.0.0 reduxapp
Need to install the following packages:
  create-react-app@5.0.0
Ok to proceed? (y) y
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

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/

Run Code Online (Sandbox Code Playgroud)
C:\Users\lg\Desktop>npm i tar

up to date, audited 153 packages in 1s

6 packages are looking for funding
  run `npm fund` for details

3 high severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
Run Code Online (Sandbox Code Playgroud)
C:\Users\lg\Desktop>npx create-react-app@5.0.0 reduxapp

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/
Run Code Online (Sandbox Code Playgroud)

我试图通过谷歌搜索解决它,但似乎出现错误,并且无法创建文件夹。

在此输入图像描述

Sat*_*ddu 60

如果您最近在旧版本上运行过此操作,请尝试清除 npx-cache。

npx clear-npx-cache
npx install -g create-react-app react-app
Run Code Online (Sandbox Code Playgroud)

  • 如果可用的话,“npx”不使用“@latest”吗?我以为这就是命令的目的?看到它缓存,我想知道“npx”和“npm i -g”有什么区别 (2认同)
  • 清除缓存然后运行“npx create-react-app react-app”对我有用!谢谢! (2认同)

小智 18

下面的命令对我有用,

npx create-react-app@latest my-app
Run Code Online (Sandbox Code Playgroud)


小智 10

因此,这些是我为使其正常工作而采取的步骤:

npm uninstall -g create-react-app

npx create-react-app@latest my-app-name
Run Code Online (Sandbox Code Playgroud)


how*_*her 8

清除 npx 缓存为我解决了这个问题:

npx clear-npx-cache
Run Code Online (Sandbox Code Playgroud)