Fixes the pnpm linker crash on leftover workspace node_modules#305
Open
jeckhart wants to merge 2 commits into
Open
Fixes the pnpm linker crash on leftover workspace node_modules#305jeckhart wants to merge 2 commits into
jeckhart wants to merge 2 commits into
Conversation
The pnpm linker only wipes the root node_modules via fs_remove_nm, but its symlink passes also write into <workspace>/node_modules/<dep> for child workspaces. Switching from the node-modules linker can leave a real directory at that path, and fs_rm_file (unlink) fails on a directory (EPERM on macOS, EISDIR on Linux); ok_missing only swallows NotFound, so install aborts with an I/O error. Uses the directory-aware fs_rm at all three symlink sites.
👷 Deploy request for yarn-v6 pending review.Visit the deploys page to approve it
|
Author
|
@arcanis - Sorry for the ping, I wasn't sure who to address this to from the project docs. I am using yarn 6 preview for some non-critical projects at work and I've found a few bugs. This was one that I thought I could help fix myself. |
Member
|
Hey John, apologies for the delay, I'll take a look tomorrow! The main thing I want to check is whether we are truly replacing all previous node_modules, or just those that would happen to conflict with directory entries created by the pnpm linker (thus incorrectly leaving in place hoisted packages). I somewhat suspect the pnpm linker should use the same fs_sync method as the NM linker rather than a direct fs_rm, to avoid that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switching a monorepo from
nodeLinker: node-modulestopnpmaborts:Repro (yarn 6.0.0-rc.18, bec529a):
The version conflict leaves
no-deps@2.0.0as a real directory atpackages/pkg-a/node_modules/no-deps. The pnpm linker's symlink pass callsfs_rm_file(unlink) on that path, which fails on a directory — EPERM on macOS, EISDIR on Linux — andok_missingonly swallows NotFound.fs_remove_nmclears the rootnode_modulesbut never the per-workspace ones.Fix: use the directory-aware
fs_rmat the three symlink sites inlink_project_pnpm. Adds a regression test that fails on currentmainand passes with the fix.Closes #304