yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.72k forks source link

Yarn win32 EINVAL trying to mkdir in cache with a colon : in the dirname when add or install from github private repo URL #7824

Open VictorBargains opened 4 years ago

VictorBargains commented 4 years ago

This is a bug.

Error: EINVAL: invalid argument, mkdir 'C:\Users\Victor\AppData\Local\Yarn\Cache\v4\npm-growop-lib-0.0.0-ref:\node_modules\growop-lib'

Yarn version:   1.17.3

Node version:   12.10.0

Platform:   win32 x64

yarn-error.log

It appears on Windows 10. I am using within Git Bash or the VSCode TTY but I think this is a platform-specific bug so my terminal shouldn't matter.

It involves having a Project A whose package.json contains a dependency of Project B which is behind a private github URL.

I have not verified if this bug occurs when referencing public URLs to git repositories instead of private ones.

It usually works fine the first time on any computer where I do a git clone and yarn install...

And when I made a Project C that is linked the same way inside Project A, via yarn add https://github.com/foo-org/project-c.git, it usually works fine to add a second github URL dependency.

But eventually, every time I try this, I get to the point where I need to add or remove one of these packages, or upgrade them, or just add another dependency... and that's when I can't get past the EINVAL mkdir error because it's trying to turn my github ref into something with a colon : character in it in the cache, which is illegal in MSDOS and windows filenames. This occurs with both yarn install and yarn add commands.

The first few times this happened, I was able to recover through some combination of rm -rf node_modules, rm yarn.lock, yarn cache clean. Now the only way I have found to recover is to modify package.json, turn the dependency into ../project-b instead of the github URL, and then cd ..; git clone https://github.com/foo-org/project-b.git to use the dependency locally rather than through node_modules.

Ami777 commented 3 years ago

Any update on that?

rudzkipl commented 3 years ago

Same issue at Windows with TeamCity Agent: image the part with ref: breaks mkdir as it is syntax error. We had to move from yarn to npm.