"No such file file or directory, lstat" for Yarn cache during package install on Windows
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I'm on Windows 10, Node v6.9.1, and Yarn 0.17.0
I'm running yarn to install packages for a personal project and during installation, I get the error:
error An unexpected error occurred: "ENOENT: no such file or directory, lstat 'C:\\Users\\[my username]\\AppData\\Local\\Yarn\\cache\\npm-gulp-4.0.0-alpha.2-58ae6d972ff84fa07ba9cc30cf7d13d9bc646f39'".
I'm guessing yarn is not a big fan of the Gulp version "github:gulpjs/gulp#4.0" which causes it to have the above issue. Running yarn cache clean and redoing the install doesn't help.
What is the expected behavior?
Installation without errors. Running npm install with npm version 3.10.8 works without a hitch.
Please mention your node.js, yarn and operating system version.
- Windows 10 Anniversary
- Node v 6.9.1
- Yarn 0.17.0
same on ubuntu
same on macOs Sierra 10.12.1
An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/[username]/Library/Caches/Yarn/npm-gulp-4.0.0-alpha.2-58ae6d972ff84fa07ba9cc30cf7d13d9bc646f39'".
I can confirm, this is a regression after 0.16.1
I tried finding the reason and could nail it down to: https://github.com/yarnpkg/yarn/blob/master/src/resolvers/exotics/hosted-git-resolver.js#L140 missing the hash attribute. This results in the package being created in the cache folder with a name without the hash (https://github.com/yarnpkg/yarn/blob/master/src/config.js#L265). After it is downloaded however the hash is set here: https://github.com/yarnpkg/yarn/blob/master/src/package-fetcher.js#L91 removing this assignment fixes the problem.
@thomaschaaf, would you try sending a PR with a unit test?
@bestander the better option would be to get the hash in https://github.com/yarnpkg/yarn/blob/master/src/resolvers/exotics/hosted-git-resolver.js#L140 here. Removing the hash updating seems nasty. Or we could not add a hash if a hash was not set until that point.
I am still trying to navigate through the code but can't figure out how it was done before.
@bestander I am sorry I can't create a unit test at the moment - as I have to be up early in the morning.
The PR should fix the problem :)
Wow that was quick! Thanks everyone! :)
Same here, with [email protected], [email protected], macOS10.12.1
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/hustcer/Library/Caches/Yarn/npm-gulp-4.0.0-alpha.2-947491601cd7d5959a48d2f305d96ef44d94b047'".
info If you think this is a bug, please open a bug report with the information provided in "/Users/hustcer/github/swift-quant/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Experiencing this problem in yarn v0.17.2 on Arch Linux 4.8.7-1-ARCH
error An unexpected error occurred: "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz:
ENOENT: no such file or directory, open '/home/warent/.cache/yarn/npm-async-each-1.0.1-19d386a1d9edc6e7c1c85d388aedbcc56d33602d/.yarn-tarball.tgz'".
Interestingly, when I updated my npm prefix, per: https://docs.npmjs.com/getting-started/fixing-npm-permissions
and then I ran yarn v0.17.2, it worked fine
Today, same problem, windows 7, yarn 0.17.9, node 6.8.1, npm 4.0.3
I had the same error using [email protected] (but no problem with [email protected])
Here my repo where I reproduced it : https://github.com/soywod/yarn-bug-1834
Main error : Error: ENOENT: no such file or directory, lstat '/Users/clementdouin/Documents/yarn-bug-1834/node_modules/chai-fs/test/fixtures/non-existing.txt'
Uname -a : Darwin MAC164 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
I am still seeing this error with 0.20.3:
✘ joscha@canvabox ~/dev/canva/web/ui master yarn cache clean
yarn cache v0.20.3
success Cleared cache.
✨ Done in 3.99s.
joscha@canvabox ~/dev/canva/web/ui master yarn install
yarn install v0.20.3
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/joscha/Library/Caches/web'".
info If you think this is a bug, please open a bug report with the information provided in "/Users/joscha/dev/canva/web/ui/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I had the similar error with [email protected],
Arguments:
/usr/local/bin/node /usr/local/bin/yarn cache ls
Yarn version:
0.21.3
Node version:
7.7.1
Platform:
darwin x64
npm manifest: No manifest
yarn manifest: No manifest
Lockfile: No lockfile
Trace:
Error: ENOTDIR: not a directory, scandir '/Users/**/Library/Caches/Yarn/npm-engine.io-1.8.3-8de7f97895d20d39b85f88eeee777b2bd42b13d4/package.json'
The lstat/ENOTDIR/ENOENT error is investigated in https://github.com/yarnpkg/yarn/issues/2629
same issue here as well, os x sierra, node 6.9.2, latest yarn
Still seeing this error with github based packages on yarn V0.27.5
Yep - a pulling a package from github completely broke our yarn as well.
I have this issue with yarn 1.6.0 node v9.11.1. Are there a way to fix this without reverting to older version?