ENOENT for yarn-metadata.json file

Whenever I try to yarn I get:

error An unexpected error occurred: "ENOENT: no such file or directory, open '/Users/Adam/Library/Caches/Yarn/v1/npm-gulp-4.0.0-alpha.2-311322480cff736e0f423389352d202c97f530e0/.yarn-metadata.json'".

I need to remove the yarn.lock file for it to work. Then after install, running yarn again fails with the same error.

Not sure why this started happening. This is with yarn 0.28.4 on OS X. I can’t upgrade to 1.0.0 due to it failing completely on Heroku.

Please let me know what I can do to help you debug this. The package it’s failing on is "gulp": "git+https://github.com/gulpjs/gulp#4.0",

Author: Fantashit

2 thoughts on “ENOENT for yarn-metadata.json file

  1. I got this error today in Yarn v1.6.0, OSX 10.13.4 while linking a dependency installed from a private GitHub repository.

    The solution for me was a yarn cache clean and a retry, worked like a charm.

  2. For anyone still struggling with this, my problem was that the shasum checksum for the offending package was wrong in yarn.lock. I downloaded the package and calculated the shasum. Changed the checksum in yarn.lock to this and it’s working now. I remember us having a similar issue before, with this same package and I don’t remember what we did to fix it the last time. So this may not be a permanent fix and yarn may change to the wrong checksum sometime later, but it works for now.

Comments are closed.