Yarn 安装失败,并出现 buffer-alloc-unsafe 包的“请求失败“304 Not Modified””错误

问题描述 投票:0回答:2

我在尝试使用 Yarn 安装软件包时遇到错误。运行

yarn install
时,进程失败并出现以下错误:

error Error: https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz: Request failed "304 Not Modified"

环境:

  • 纱线版本:1.22.22
  • 操作系统:macOS 14.5 (23F79)
  • Node.js 版本:v23.4.0

完整错误输出:

[2/4] 🚚  Fetching packages...
error Error: https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz: Request failed "304 Not Modified"
    at ResponseError.ExtendableBuiltin (/opt/homebrew/Cellar/yarn/1.22.22/libexec/lib/cli.js:696:66)
    at new ResponseError (/opt/homebrew/Cellar/yarn/1.22.22/libexec/lib/cli.js:802:124)
    at Request.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.22/libexec/lib/cli.js:66750:16)
    at Request.emit (node:events:513:28)
    at module.exports.Request.onRequestResponse (/opt/homebrew/Cellar/yarn/1.22.22/libexec/lib/cli.js:142287:10)
    at ClientRequest.emit (node:events:513:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:710:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)
    at TLSSocket.socketOnData (node:_http_client:552:22)
    at TLSSocket.emit (node:events:513:28)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

我尝试过的:

  • 清除纱线缓存
  • 删除node_modules和yarn.lock
  • 从系统中删除纱线并重新安装

如何解决此安装错误并成功安装我的依赖项?

javascript yarnpkg package-management
2个回答
0
投票

我也开始收到错误,但针对不同的模块

Error: https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz: Request failed "304 Not Modified"

0
投票

错误错误:https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz:请求失败“304未修改”

© www.soinside.com 2019 - 2024. All rights reserved.