[Bug?]: `yarn dlx` breaks with hardlinked node modules
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
yarn dlx breaks when nmMode is set to hardlinks-[local/global]
To reproduce
await yarn('init', '-y');
await yarn('config', 'set', 'enableGlobalCache', 'true');
await yarn('config', 'set', 'nodeLinker', 'node-modules');
await yarn('config', 'set', 'nmMode', 'hardlinks-global');
await expect(yarn('dlx', 'sirv-cli', '-v')).rejects.not.toThrow();
Environment
System: OS: Linux 5.12 Arch Linux CPU: (4) x64 Intel® Core™ i3-5005U CPU @ 2.00GHz Binaries: Node: 16.5.0 - /tmp/xfs-c1cde8a3/node Yarn: 3.0.0 - /tmp/xfs-c1cde8a3/yarn npm: 7.20.0 - ~/.local/npm-global/bin/npm
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Cannot find module (any module) using PnP · Issue #3458 ...
Self-service I'd be willing to implement a fix Describe the bug Something went very wrong with my yarn install I think.
Read more >Introducing Yarn 2 ! 🧶🌟 - DEV Community 👩💻👨💻
The yarn package on npm will not change; we will distribute further ... Yarn 2 introduces a new command called yarn dlx (dlx...
Read more >@yarnpkg/plugin-dlx | Yarn - Package Manager
Peer dependencies depending on their own parent are now properly hoisted by the node-modules linker. Boolean values will be properly interpreted when specified ......
Read more >Migration | Yarn - JavaScript 软件包管理器
Any major release has its breaking changes, and Yarn 2 isn't the exception. A few old behaviors were cleaned, fixed, modified, or removed....
Read more >After creating a React app with yarn dlx ...
js". My solution was to disable plug'n'play by setting nodeLinker: node-modules in .yarnrc.yml.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

We can set dlx specific settings like I did in https://github.com/yarnpkg/berry/pull/2677 but we should probably not make that the solution in this case since any project can be on a different device than the cache, perhaps we could gracefully downgrade to
hardlinks-localSince it would only fix
yarn dlxand wouldn’t help for cases like https://github.com/yarnpkg/berry/issues/3191I write this after looking at https://github.com/yarnpkg/berry/pull/3204 but I think just making the linker fallback to
hardlinks-localin general is good enough, it’s unlikely that different parts of thenode_modulesfolder is on different devices