【问题标题】:纱线安装抛出错误请求失败“404 未找到”
【发布时间】:2018-08-28 11:53:21
【问题描述】:

我对我在笔记本电脑上工作的本机项目做出了反应。当我将项目转移到我的电脑并运行 yarn install 时(我使用 yarn 安装了一些模块,而一些使用 npm 安装了)我得到了

发生意外错误:“https://registry.yarnpkg.com/jest/-/jest-23.0.0-alpha.0.tgz: Request failed \"404 Not Found\"”。

我的电脑和笔记本电脑上的纱线版本相同

1.5.1

npm 版本我的电脑和 latop 一样

5.4.1

节点版本

v 7.9.0

此外,在我的项目上运行 yarn install 时我会收到警告

warning You are using Node "7.9.0" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"

【问题讨论】:

  • 您的笔记本电脑上的节点版本是多少?首先你应该在你的电脑上更新它。顺便说一句,你能用 jest 显示 packages.json 中的行吗?
  • 我找到了解决方案,我发布了我的答案

标签: node.js react-native npm yarnpkg


【解决方案1】:

我今天在CircleCI遇到这个问题,原来是缓存问题:

yarn cache clean
yarn install

实际上我不得不运行yarn install 两次但不知道为什么。

【讨论】:

    【解决方案2】:

    如果您使用 private npm 软件包获取此信息,请确保您使用正确的用户登录

    运行npm login

    Docs

    【讨论】:

      【解决方案3】:

      我遇到了类似的问题,得到: An unexpected error occurred: "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.0.tgz: Request failed \"404 Not Found\"".

      删除yarn.lock 并运行yarn 可能会导致大量软件包升级,并可能导致其他配置问题。

      相反,我只是从yarn.lock 中删除了es-abstract 分辨率部分,例如:

      es-abstract@^1.11.0, es-abstract@^1.5.1, es-abstract@^1.7.0:
        version "1.14.0"
        resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.0.tgz#f59d9d44278ea8f90c8ff3de1552537c2fd739b4"
        integrity sha512-lri42nNq1tIohUuwFBYEM3wKwcrcJa78jukGDdWsuaNxTtxBFGFkKUQ15nc9J+ipje4mhbQR6JwABb4VvawR3A==
        dependencies:
          es-to-primitive "^1.2.0"
          function-bind "^1.1.1"
          has "^1.0.3"
          has-symbols "^1.0.0"
          is-callable "^1.1.4"
          is-regex "^1.0.4"
          object-inspect "^1.6.0"
          object-keys "^1.1.1"
          string.prototype.trimleft "^2.0.0"
          string.prototype.trimright "^2.0.0"
      

      然后运行yarn。这解决了在yarn.lock 中进行最少升级的问题。

      【讨论】:

        【解决方案4】:

        我找到了解决办法

        yarn config set registry https://registry.npmjs.org
        rm yarn.lock
        yarn
        

        【讨论】:

        • 我遇到了同样的问题:error An unexpected error occurred: "https://registry.yarnpkg.com/src-map/-/src-map-0.5.7.tgz: Request failed \"404 Not Found\"". 这个解决方案对我有用。这似乎是纱线依赖锁的问题
        • ...yarnpkg.com/serve-... 有 404 个问题,这解决了。 Yarn 在 2.0 之后会分崩离析吗?
        猜你喜欢
        • 1970-01-01
        • 2022-06-14
        • 2018-02-26
        • 1970-01-01
        • 1970-01-01
        • 2022-08-18
        • 1970-01-01
        • 1970-01-01
        • 2021-10-22
        相关资源
        最近更新 更多