【问题标题】:No matching version found for react-dev-utils@^12.0.0没有找到 react-dev-utils@^12.0.0 的匹配版本
【发布时间】:2022-02-15 10:04:28
【问题描述】:

我正在尝试使用npx create-react-app client 创建一个反应应用程序。

我收到以下错误:

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code ETARGET
npm ERR! notarget No matching version found for react-dev-utils@^12.0.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\uzair\AppData\Local\npm-cache\_logs\2022-02-04T05_42_25_207Z-debug-0.log

Aborting installation.
  npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
Deleting client/ from C:\Projects\Exhibition Gate\ExhibitionGate
Done.

Find Error Image Here

【问题讨论】:

    标签: reactjs npm create-react-app


    【解决方案1】:

    当您运行npx create-react-app client 时,它将下载所有需要的开发依赖项。 这些通常在package.json中指定

    它声称找不到react-dev-utils@^12.0.0

    1.判断这个包是否存在

    react-dev-utils@12.0.0 存在,所以应该没问题。

    2。看看能不能下载

    确保您可以实际下载它。您的公司可能会在代理等中阻止它。

    # create a new directory to test this in
    mkdir test_app
    
    # create a new empty package.json file
    npm init -y
    
    # add react-dev-utils@^12.0.0 to check it can be found.
    npm install react-dev-utils@^12.0.0
    

    当一切按计划进行时。这应该运行几秒钟并下载所需的文件。 你最终会得到一个node_modules 文件夹,其中包含react-dev-utils@12.0.0 所需的所有文件

    如果没有,那么您应该尝试解决它提示的任何问题。

    要检查的一件事是设置了哪些注册表:

    npm config get registry
    > https://registry.npmjs.org/
    

    3。行为不端的缓存

    您可能需要清除缓存以排除任何不正确/陈旧的缓存。

    npm cache clean --force
    

    【讨论】:

      猜你喜欢
      • 2022-11-10
      • 2020-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      • 2020-08-22
      • 1970-01-01
      • 2022-07-26
      相关资源
      最近更新 更多