Yarn: EINVAL: invalid argument, lstat

Created on 16 Aug 2017  路  14Comments  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?

Le Bug :bug:

What is the current behavior?
Strangely can't install after trying to install temporarily and then removing babel@7 alpha. Probably related to #4106

yarn install v1.0.0-20170816.1304
info No lockfile found.
[1/6] Validating package.json...
[2/6] Resolving packages...
[3/6] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/6] Linking dependencies...
warning "[email protected]" has incorrect peer dependency "ajv@>=4.10.0".
warning "[email protected]" has incorrect peer dependency "ajv@>=5.0.0".

error An unexpected error occurred: "EINVAL: invalid argument, lstat '/mnt/c/Users/selarkin/Code/example-webpack-loader/node_modules/acorn-globals/README.md'".
info If you think this is a bug, please open a bug report with the information provided in "/mnt/c/Users/selarkin/Code/example-webpack-loader/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


If the current behavior is a bug, please provide the steps to reproduce.
cloned https://github.com/TheLarkInn/example-webpack-loader
Ran yarn, and then the error occurred.

What is the expected behavior?
Install to work correctly

Please mention your node.js, yarn and operating system version.
WSL on Windows Insider Preview 170813-1700 (Internal Self Hosted OS Build)

Yarn Error Log

Arguments: 
  /home/selarkin/.nvm/versions/node/v7.10.1/bin/node /usr/share/yarn/bin/yarn.js

PATH: 
  /home/selarkin/bin:/home/selarkin/.local/bin:/home/selarkin/.nvm/versions/node/v7.10.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Users/selarkin/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files/Microsoft VS Code Insiders/bin:/snap/bin

Yarn version: 
  1.0.0-20170816.1304

Node version: 
  7.10.1

Platform: 
  linux x64

npm manifest: 
  {
    "scripts": {
      "webpack-defaults": "webpack-defaults",
      "start": "npm run build -- -w",
      "appveyor:test": "npm run test",
      "build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js'",
      "clean": "del-cli dist",
      "lint": "eslint --cache src test",
      "lint-staged": "lint-staged",
      "prebuild": "npm run clean",
      "prepublish": "npm run build",
      "release": "standard-version",
      "security": "nsp check",
      "test": "jest",
      "test:watch": "jest --watch",
      "test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage",
      "travis:lint": "npm run lint && npm run security",
      "travis:test": "npm run test -- --runInBand",
      "travis:coverage": "npm run test:coverage -- --runInBand"
    },
    "devDependencies": {
      "babel-cli": "6.26.0",
      "babel-jest": "^20.0.3",
      "babel-plugin-transform-object-rest-spread": "^6.23.0",
      "babel-polyfill": "^6.23.0",
      "babel-preset-env": "^1.6.0",
      "bluebird": "^3.5.0",
      "cross-env": "^5.0.5",
      "del-cli": "^1.1.0",
      "eslint": "^4.4.1",
      "eslint-config-webpack": "^1.2.5",
      "eslint-plugin-import": "^2.7.0",
      "jest": "^20.0.4",
      "lint-staged": "^4.0.3",
      "loader-runner": "^2.3.0",
      "memory-fs": "^0.4.1",
      "nsp": "^2.7.0",
      "pre-commit": "^1.2.2",
      "standard-version": "^4.2.0",
      "webpack": "^3.5.4",
      "webpack-defaults": "^1.5.0"
    },
    "main": "dist/cjs.js",
    "files": [
      "dist"
    ],
    "engines": {
      "node": ">= 4.3 < 5.0.0 || >= 5.10"
    },
    "peerDependencies": {
      "webpack": "^2.0.0 || ^3.0.0"
    },
    "pre-commit": "lint-staged",
    "lint-staged": {
      "*.js": [
        "eslint --fix",
        "git add"
      ]
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Trace: 
  Error: EINVAL: invalid argument, lstat '/mnt/c/Users/selarkin/Code/example-webpack-loader/node_modules/acorn-globals/README.md'
os-windows

Most helpful comment

All 14 comments

Hm strange, I can't reproduce it (on OSX tho) 馃 Does /mnt/c/Users/selarkin/Code/example-webpack-loader/node_modules/acorn-globals/README.md exists? Is it a symlink?

I can try giving this a shot in WSL soonish if we can track it down to Windows or WSL.

Just updated to the latest build of Windows 10 Pro Insider Preview 16273.rs3_release.170819-1253. Also running into this issue in WSL.

I made a new folder called yarn-install-test and did yarn init with all the default values. I then did yarn add debug which worked. I then tried to yarn add babel-core, lodash, and tap and those came up with the following errors:

suitupalex@aMartinBlade /m/c/U/a/D/m/t/yarn-install-test> yarn add babel-core
yarn add v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error An unexpected error occurred: "EINVAL: invalid argument, lstat '/mnt/c/Users/alex/Development/martin-experiments/temp/yarn-install-test/node_modules/lodash/_getSymbolsIn.js'".
info If you think this is a bug, please open a bug report with the information provided in "/mnt/c/Users/alex/Development/martin-experiments/temp/yarn-install-test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
suitupalex@aMartinBlade /m/c/U/a/D/m/t/yarn-install-test> yarn add lodash
yarn add v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error An unexpected error occurred: "EINVAL: invalid argument, lstat '/mnt/c/Users/alex/Development/martin-experiments/temp/yarn-install-test/node_modules/lodash/_mapCacheClear.js'".
info If you think this is a bug, please open a bug report with the information provided in "/mnt/c/Users/alex/Development/martin-experiments/temp/yarn-install-test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
suitupalex@aMartinBlade /m/c/U/a/D/m/t/yarn-install-test> yarn add tap
yarn add v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error An unexpected error occurred: "EINVAL: invalid argument, lstat '/mnt/c/Users/alex/Development/martin-experiments/temp/yarn-install-test/node_modules/arr-diff/README.md'".
info If you think this is a bug, please open a bug report with the information provided in "/mnt/c/Users/alex/Development/martin-experiments/temp/yarn-install-test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Downloading the nightly build (1.0.0-20170823.1414) didn't help.

Running yarn cache clean didn't help either.

Looks like everything works OK if you're not inside /mnt/c.

@TheLarkInn Hey, by the way, the WSL team wants to see these bug reports rather than having them worked around. If you didn't file this internally at MS or as an issue on the WSL repository, you definitely should. The WSL devs don't want permanent workarounds being added in for WSL, since it makes it harder to test if their code is working, just FYI.

I'll ping @sunilmut for you.

thanks @fpqc.

@TheLarkInn - As per @suitupalex comment, Looks like everything works OK if you're not inside /mnt/c., it appears that this is only an issue in DrvFS (example /mnt/c) and not in LxFS (ex: ~, / etc). Does this issue repro for you in in your WSL home directory?

This happens to me now on build 16278.rs3_release.17082501441 I think my PC upgraded itself yesterday so now I can't use yarn install :(

@sunilmut I have reverted my build back to 16251.rs3_release.170721-2122 and yarn is working fine. (I have to do a clean build of my computer though...)

Do you think we can close this since this looks more like a WSL bug instead of a Yarn bug?

I would say yes since this looks like a WSL issue.

Thanks @sunilmut!

@sunilmut is there a way to track this issue on WSL? My workaround at the moment is to yarn install in a different directory then copy node_modules over to my /mnt/c folder. Not a big hassle but kind of annoying

Hey sorry for the late followup here. I wasn't sure if it was a yarn or WSL bug but it looks to be WSL related instead. Thanks for the heads up for next time!

For anyone else running into this issue, the solution that worked for us was to move node_modules to another directory outside of any /mnt volume, then symlink to the location from the project:

cd /your/project/directory
mv node_modules /node_modules
ln -s /node_modules node_modules

Just noticed that this is the same solution as what @khuongduybui put together on https://github.com/Microsoft/WSL/issues/2448. While this was potentially a WSL bug per @suitupalex's linked issue, we're running yarn 1.6.0, with Windows build 16299 per the other thread, and yet this problem could still only be fixed by this workaround.

Was this page helpful?
0 / 5 - 0 ratings