-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
corepack seems to obey LOCALAPPDATA silently #673
Comments
This sounds like it is a configuration issue with WSL2 that you have already resolved with your workaround, not a bug in Corepack or Yarn. If you think it is a bug in Corepack, I suggest you re-run your commands with corepack enable yarn
export DEBUG=corepack
COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn install Please mention also which Linux distro you are running in WSL2. |
I agree that it's not a technical bug in corepack (or yarn); however, it is an edge case that deserves to be documented. I wouldn't have raised it if there was obvious documentation about "what environment variables will always override the default location for cache storage" (or whatever this is); there isn't, or it wasn't obviously searchable. Happy for you to close this as you see fit; it's here so that it's not some xkcd#959 |
I don't know about "silently", the README says this: Lines 334 to 335 in 19e3c68
But anyway, I agree we could try to improve the error output and/or the README to help users with this issue, PRs welcome |
I tried setting cd $(mktemp -d)
rm -rf $LOCALAPPDATA/node/corepack
rm -rf ~/.cache/node/corepack
corepack enable yarn
export DEBUG=corepack
corepack use yarn@latest
I see that Corepack is using Lines 334 to 337 in 19e3c68
|
This is also reproducible in a pure Ubuntu environment with no WSL2 involved. If |
To reproduce on Ubuntu: npm install corepack@latest -g
mkdir $HOME/localappdata
export LOCALAPPDATA="$HOME/localappdata"
rm -rf $LOCALAPPDATA/node
rm -rf ~/.cache/node
cd $(mktemp -d)
corepack enable yarn
export DEBUG=corepack
corepack install -g yarn@latest
find $LOCALAPPDATA
find ~/.cache/node Logs
|
Although I'm able to reproduce Corepack using the wrong cache directory under a pure Linux environment, I wasn't able to reproduce your The rename error is in any case a separate issue, and the title of the issue here is "corepack seems to obey LOCALAPPDATA silently". |
That's cool, I feel the ENOACCESS error is down to the very specific way NTFS is setup round here (something blah blah AD permissions not inherited by WSL2 something something), and it's a red herring. I agree that your investigations (thanks!) show that the problem is LOCALAPPDATA being used regardless of platform. WSL2 should be treated as vanilla linux by corepack. I've got a usable workaround (I'm not a nodejs dev by trade) so it's not breaking my workflow which is mostly AWS CDK. |
Great to hear you have a useable workaround! |
It seems the error is in corepack/sources/folderUtils.ts Lines 14 to 24 in 19e3c68
where npm, pnpm and Yarn all are using |
Platform : WSL2
If because of reasons you have
WSLENV=WT_SESSION:WT_PROFILE_ID:LOCALAPPDATA/p:USERPROFILE/p:APPDATA/p
to pass through LOCALAPPDATA & APPDATA to your WSL2 environment then you get permissions errors when trying to use yarn + corepackThis never used to happen, and I'm not sure if it's 'yarn' or 'corepack' that is the issue (there aren't any PRs or issues that mention
appdata
that seem related).My current workaround is to use
direnv
to unset both those environment variablesThe text was updated successfully, but these errors were encountered: