【问题标题】:You are running `create-react-app` 5.0.0, which is behind the latest release (5.0.1). M1 Mac您正在运行 `create-react-app` 5.0.0,它落后于最新版本 (5.0.1)。 M1 麦克
【发布时间】:2022-08-17 08:02:29
【问题描述】:

----- 更新 - 已解决 ----

使用yarn create react-app my-app 似乎对我有用。


试图创建一个新的反应应用程序并面临这个问题。其他人的解决方案对我没有用,所以发布了我到目前为止所采取的步骤。

npx create-react-app my-app

返回

You are running `create-react-app` 5.0.0, which is behind the latest release (5.0.1).

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

up to date, audited 1 package in 131ms

found 0 vulnerabilities

yarn global remove create-react-app

yarn global v1.22.17
warning package.json: No license field
[1/2] ????  Removing module create-react-app...
error This module isn\'t specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

尝试按照一些建议清除缓存

npx clear-npx-cache

Need to install the following packages:
  clear-npx-cache
Ok to proceed? (y) y

那里没有发生太多事情

试图找到反应安装 npm ls -g create-react-app

/usr/local/lib
└── (empty)


正如一些人建议的那样尝试了@latest

npx create-react-app@latest my-app

Need to install the following packages:
  create-react-app@latest
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` 5.0.0, which is behind the latest release (5.0.1).

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/

我正在使用运行 macOS 12.3.1 的 13\" M1

- - - 更新 - - -

我在全球范围内重新安装了它,然后按照一些建议将其卸载,现在发生了这种情况。

npm install -g create-react-app npm uninstall -g create-react-app npx create-react-app my-app

A template was not provided. This is likely because you\'re using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
You can fix this by running npm uninstall -g create-react-app or yarn global remove create-react-app before using create-react-app again.

package.json image

    标签: reactjs npm


    【解决方案1】:

    尝试这个:

    npm uninstall -g create-react-app
    

    然后打开C:\Users\Your_user_name\AppData\Roaming\npm-cache 删除文件夹中的所有内容。

    打开C:\Users\Your_user_name\AppData\Roaming\npm删除与create-react-app相关的所有内容

    然后最后:

    npx create-react-app my-project
    

    【讨论】:

      猜你喜欢
      • 2022-06-13
      • 2022-01-18
      • 2021-10-23
      • 2022-01-21
      • 2022-01-18
      • 2022-01-18
      • 2022-07-11
      • 1970-01-01
      • 2021-12-03
      相关资源
      最近更新 更多