skip to Main Content

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


  1. Chosen as BEST ANSWER

    This should fix the error, for me it worked

    npm config set registry https://registry.npmmirror.com/ --global


  2. I have started getting the error too but for a different module

    Error: https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz: Request failed "304 Not Modified"
    
    Login or Signup to reply.
  3. error Error: https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz: Request failed "304 Not Modified"

    Login or Signup to reply.
  4. Found the same discussion ongoing on NPM Github issues thread here. Seems to be a recent issue seen around India (Mumbai) region.

    Login or Signup to reply.
  5. I am also getting the error but for a different module. Can somebody help ?

    Error: https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz: Request failed "304 Not Modified"
    
    Login or Signup to reply.
  6. Same issue for different repo

    An unexpected error occurred: "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz: Request failed "304 Not Modified"
    
    Login or Signup to reply.
  7. the Same Issue I am also getting while running a yarn install through AWS codeBuild but with different package issues.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search