Skip to content
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

[Bug?]: After using a symbolic link to move the global cache folder to another partition, "yarn dlx" failed. #6497

Open
1 task
frg2089 opened this issue Sep 13, 2024 · 1 comment
Labels
bug Something isn't working waiting for feedback Will autoclose in a while unless more data are provided

Comments

@frg2089
Copy link

frg2089 commented Sep 13, 2024

Self-service

  • I'd be willing to implement a fix

Describe the bug

Microsoft provides a Dev Drive feature in Windows, and they recommend storing package cache, source code, and other content in this drive.
I couldn't find the place to set up the global cache folder, so I used symbolic links to move Yarn's cache folder to this partition.
This usually works well, but when I use the yarn dlx command, it creates a temporary project in the% TEMP% folder and then fails due to cross partition linking, like this:

[Error: EXDEV: cross-device link not permitted,  link 'C:\Users\<UserName>\AppData\Local\Yarn\Berry\index\bb\*.dat' -> 'C:\Users\<UserName>\AppData\Local\Temp\xfs-5633e527\dlx-15420\node_modules\.store\*\package\LICENSE']

To reproduce

Move Yarn's global cache folder to another partition.
Create a symbolic link pointing to a new global cache folder location.
Using the yarn dlx command.

Environment

System:
  OS: Windows 11 10.0.26120
  CPU: (8) x64 AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx  
Binaries:
  Node: 20.11.1 - C:\Users\<UserName>\AppData\Local\Temp\xfs-6fb8e9e9\node.CMD
  Yarn: 4.1.1 - C:\Users\<UserName>\AppData\Local\Temp\xfs-6fb8e9e9\yarn.CMD
  npm: 10.2.4 - D:\Program Files\nodejs\npm.CMD

---
# I noticed that the path recognized by envinfo seems to be inaccurate. Here is the actual entry file when I execute the command.
PS>@('node','yarn','npm')|%{gcm $_}

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     node.exe                                           20.11.1.0  D:\Program Files\nodejs\node.exe
ExternalScript  yarn.ps1                                                      D:\Program Files\nodejs\yarn.ps1
Application     npm.cmd                                            0.0.0.0    D:\Program Files\nodejs\npm.cmd

Additional context

yarn dlx -q envinfo --preset jest
➤ YN0001: │ Error: EXDEV: cross-device link not permitted, link 'C:\Users\<UserName>\AppData\Local\Yarn\Berry\index\bc\bc5e9c3195095194973fd9732cedd94d4aad5a6d.dat' -> 'C:\Users\<UserName>\AppData\Local\Temp\xfs-16c48bd1\dlx-18596\node_modules\.store\envinfo-npm-7.14.0-624fecc5a5\package\LICENSE'
➤ YN0000: · Failed with errors in 1s 291ms
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: EXDEV: cross-device link not permitted, link 'C:\Users\<UserName>\AppData\Local\Yarn\Berry\index\bc\bc5e9c3195095194973fd9732cedd94d4aad5a6d.dat' -> 'C:\Users\<UserName>\AppData\Local\Temp\xfs-16c48bd1\dlx-18596\node_modules\.store\envinfo-npm-7.14.0-624fecc5a5\package\LICENSE'] {
  errno: -4037,
  code: 'EXDEV',
  syscall: 'link',
  path: 'C:\\Users\\Shimakaze\\AppData\\Local\\Yarn\\Berry\\index\\bc\\bc5e9c3195095194973fd9732cedd94d4aad5a6d.dat',
  dest: 'C:\\Users\\SHIMAK~1\\AppData\\Local\\Temp\\xfs-16c48bd1\\dlx-18596\\node_modules\\.store\\envinfo-npm-7.14.0-624fecc5a5\\package\\LICENSE'
}

Node.js v20.11.1
@frg2089 frg2089 added the bug Something isn't working label Sep 13, 2024
@clemyan
Copy link
Member

clemyan commented Sep 17, 2024

Looks like you have globally set nodeLinker: pnpm? If so this is one of the limitations of the pnpm linker: your globalFolder and the project (in this case, the temporary folder) must be on the same drive because the pnpm linker needs to create hardlinks between those.

@clemyan clemyan added the waiting for feedback Will autoclose in a while unless more data are provided label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for feedback Will autoclose in a while unless more data are provided
Projects
None yet
Development

No branches or pull requests

2 participants