【问题标题】:Error while creating new React app ("You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0)")创建新的 React 应用程序时出错(您正在运行 `create-react-app` 4.0.3,它落后于最新版本 (5.0.0))
【发布时间】:2022-01-18 07:57:05
【问题描述】:

即使在执行卸载部分之后,我也一次又一次地收到此创建反应应用程序错误。

npm uninstall -g create-react-app

最新,在 570 毫秒内审核了 1 个包

发现 0 个漏洞

npx create-react-app test-app

需要安装以下包:create-react-app 就可以了 继续? (y) 是的

您正在运行create-react-app 4.0.3,它落后于最新版本 发布 (5.0.0)。

我们不再支持全局安装 Create React App。

请使用以下命令之一删除所有全局安装:

  • npm 卸载 -g create-react-app
  • yarn 全局删除 create-react-app

可在此处找到有关创建新应用的最新说明: https://create-react-app.dev/docs/getting-started/

C:\>npm --version
8.3.0
C:\>node --version
v16.13.0

谁能帮帮我。

【问题讨论】:

    标签: reactjs


    【解决方案1】:

    我都试过了,它们都很好用。您可以尝试其中任何一种。

    npx create-react-app@5.0.0 my-app 要么 npx clear-npx-cache

    【讨论】:

      【解决方案2】:

      我已通过以下步骤解决:

      1) npm uninstall -g create-react-app
      
      2) npx clear-npx-cache
      
      3) npx create-react-app myapp
      

      【讨论】:

      • 嗯,终于可以了。谢谢
      【解决方案3】:

      我遵循了上述建议,但并没有解决我的问题。 下面的陡峭解决了我的问题

      1- 了解 npm 缓存文件夹路径:
      npm 缓存验证
      这为您提供了 npm 缓存文件夹路径: 缓存验证和压缩 (~\AppData\Local\npm-cache_cacache)

      2- 转到“..\npm-cache”文件夹并删除所有内容

      3- 创建您的项目:
      npx create-react-app my-app

      【讨论】:

        【解决方案4】:

        (npx create-react-app@5.0.0 my-app) 就像一个魅力,现在它也比旧的 react js 快得多

        【讨论】:

          【解决方案5】:

          你试过跑步吗:

          npx clear-npx-cache 清除你的 npx 缓存然后运行npx create-react-app your-app 命令?

          还可以查看this answer 清除缓存。

          此外,可能值得尝试强制使用最新版本:

          npx create-react-app@latest my-app --use-npm

          【讨论】:

          • 谢谢阿德里安,清除缓存后就可以使用了。
          • 谢谢老兄!!!!
          【解决方案6】:

          您必须清除 npx 缓存才能使其正常工作。

          您可以使用 npm ls -g create-react-app 找到安装 create-react-app 的文件夹的位置

          另外,清除缓存参考这个答案https://stackoverflow.com/a/66019858/5599770

          【讨论】:

          • 感谢您的评论 Sawan,是的,清除缓存确实解决了我的问题。
          猜你喜欢
          • 2022-01-18
          • 2021-10-23
          • 2022-06-13
          • 2022-01-21
          • 2022-08-17
          • 2022-01-18
          • 1970-01-01
          • 2021-04-26
          • 2021-11-27
          相关资源
          最近更新 更多