I’m encountering an error while trying to install packages using Yarn. When running yarn install
, the process fails with the following error:
error Error: https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz: Request failed "304 Not Modified"
Environment:
- Yarn version: 1.22.22
- Operating System: macOS 14.5 (23F79)
- Node.js version: v23.4.0
Full error output:
[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.
What I’ve tried:
- Clearing Yarn cache
- Deleting node_modules and yarn.lock
- Removed yarn from system and re install
How can I resolve this installation error and successfully install my dependencies?
7
Answers
This should fix the error, for me it worked
npm config set registry https://registry.npmmirror.com/ --global
I have started getting the error too but for a different module
error Error: https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz: Request failed "304 Not Modified"
Found the same discussion ongoing on NPM Github issues thread here. Seems to be a recent issue seen around India (Mumbai) region.
I am also getting the error but for a different module. Can somebody help ?
Same issue for different repo
the Same Issue I am also getting while running a yarn install through AWS codeBuild but with different package issues.