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
相关产品推荐
相关产品推荐

