You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

yarn install完整性校验失败但哈希正确的问题求助

Yarn安装d3-color时完整性校验失败的问题

执行yarn install时出现以下完整性校验错误:

$ yarn install
yarn install v1.22.22
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error https://registry.yarnpkg.com/d3-color/-/d3-color-3.1.0.tgz: Integrity check failed for "d3-color" (computed integrity doesn't match our records, got "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA== sha1-OVsoM9+scVB/EqwvevI7+BneJOI=")

已尝试的操作

  • 执行yarn cache clean和rm -rf node_modules,问题未解决
  • 确认yarn.lock中d3-color的哈希与完整性值均正确,尝试修改integrity字段的多种哈希组合,无效:
    "d3-color@1 - 3":
      version "3.1.0"
      resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-3.1.0.tgz#6594da178ded6c7c3842f3cc0ac84b156f12f2d4"
      integrity "sha1-OVsoM9+scVB/EqwvevI7+BneJOI= sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA=="
    
  • 执行yarn install --update-checksums后再执行yarn install可正常安装,但该命令未修改yarn.lock,且不希望每次构建都执行此操作:
    $ git status
    HEAD detached at 13cc87725
    nothing to commit, working tree clean
    $ yarn install --update-checksums
    yarn install v1.22.19
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    [3/4] Linking dependencies...
    warning " > @***/react-library@1.33.0" has incorrect peer dependency "i18next@^23.4.5".
    warning " > @***/react-library@1.33.0" has incorrect peer dependency "react-i18next@^13.2.0".
    warning "@***/react-library > react-dom@18.3.1" has incorrect peer dependency "react@^18.3.1".
    warning "i18next-scanner > acorn-dynamic-import@4.0.0" has incorrect peer dependency "acorn@^6.0.0".
    warning "@openapitools/openapi-generator-cli > @nestjs/axios@0.0.8" has incorrect peer dependency "@nestjs/common@^7.0.0 || ^8.0.0".
    warning " > service-worker-loader@4.0.2" has incorrect peer dependency "webpack@^3.0.0 || ^4.0.0".
    [4/4] Building fresh packages...
    $ husky install
    husky - Git hooks installed
    Done in 136.48s.
    $ yarn install
    yarn install v1.22.19
    [1/4] Resolving packages...
    success Already up-to-date.
    $ husky install
    husky - Git hooks installed
    Done in 0.73s.
    $ git status
    HEAD detached at 13cc87725
    nothing to commit, working tree clean
    

当前环境配置

  • 私有包使用GitLab作为自定义仓库,公共包来自npmjs/registry.yarnpkg.com
  • .npmrc配置如下:
    @<private-namespace>:registry=https://<gitlab url>/api/v4/projects/24549/packages/npm/
    //<gitlab url>/api/v4/projects/24549/packages/npm/:_authToken=<gitlab personal access token>
    

请问问题出在哪里?

内容的提问来源于stack exchange,提问作者mles

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 02:17:13