yarn icon indicating copy to clipboard operation
yarn copied to clipboard

"No such file file or directory, lstat" for Yarn cache during package install on Windows

Open AntJanus opened this issue 10 years ago • 34 comments

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

AntJanus avatar Nov 15 '16 04:11 AntJanus

same on ubuntu

adrai avatar Nov 15 '16 06:11 adrai

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'".

eltuza avatar Nov 15 '16 15:11 eltuza

I can confirm, this is a regression after 0.16.1

bestander avatar Nov 15 '16 16:11 bestander

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 avatar Nov 15 '16 22:11 thomaschaaf

@thomaschaaf, would you try sending a PR with a unit test?

bestander avatar Nov 15 '16 22:11 bestander

@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.

thomaschaaf avatar Nov 15 '16 22:11 thomaschaaf

@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 :)

thomaschaaf avatar Nov 15 '16 23:11 thomaschaaf

Wow that was quick! Thanks everyone! :)

AntJanus avatar Nov 15 '16 23:11 AntJanus

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.

hustcer avatar Nov 16 '16 04:11 hustcer

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'".

warent avatar Nov 16 '16 16:11 warent

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

warent avatar Nov 16 '16 17:11 warent

Today, same problem, windows 7, yarn 0.17.9, node 6.8.1, npm 4.0.3

nxpatterns avatar Nov 30 '16 14:11 nxpatterns

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

[email protected]

soywod avatar Feb 16 '17 14:02 soywod

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.

joscha avatar Feb 27 '17 01:02 joscha

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'

czyin avatar Mar 02 '17 04:03 czyin

The lstat/ENOTDIR/ENOENT error is investigated in https://github.com/yarnpkg/yarn/issues/2629

bestander avatar Mar 02 '17 10:03 bestander

same issue here as well, os x sierra, node 6.9.2, latest yarn

kellyrmilligan avatar May 16 '17 14:05 kellyrmilligan

Still seeing this error with github based packages on yarn V0.27.5

tortilaman avatar Aug 08 '17 18:08 tortilaman

Yep - a pulling a package from github completely broke our yarn as well.

GeeWee avatar Aug 15 '17 09:08 GeeWee

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?

vtno avatar May 07 '18 09:05 vtno