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

Yarn安装时获取buffer-alloc-unsafe包出现304 Not Modified错误的解决求助

Yarn安装时获取buffer-alloc-unsafe包出现304 Not Modified错误的解决求助

大家好,我在使用Yarn安装项目依赖的时候碰到了一个问题,执行yarn install命令时,安装流程在拉取包的阶段失败了,具体报错如下:

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

环境信息

  • Yarn版本: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.

我已经尝试过的解决方法

  • 清除Yarn的缓存
  • 删除了项目根目录下的node_modules文件夹和yarn.lock文件,重新执行安装
  • 卸载了系统上的Yarn,然后重新安装了一遍

但这些操作都没能解决问题,有没有朋友知道我该怎么处理这个错误,顺利完成依赖包的安装呢?

备注:内容来源于stack exchange,提问作者Meet Patel

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.14 17:59:34