fix: resolve relative file: dependencies correctly with install-strategy=linked#9030
Merged
wraithgar merged 1 commit intonpm:latestfrom Mar 4, 2026
Conversation
951f620 to
10c30a7
Compare
wraithgar
reviewed
Mar 3, 2026
wraithgar
reviewed
Mar 3, 2026
manzoorwanijk
commented
Mar 3, 2026
wraithgar
reviewed
Mar 3, 2026
wraithgar
reviewed
Mar 3, 2026
Member
|
manually applied just the code changes to my refactor branch and tests all passed. |
a4d7f6e to
c7311a1
Compare
Member
|
We landed the refactor which means it's time to resolve conflicts. If you're comfortable doing that go ahead. If you're not just let us know and we'll help. |
…tegy Local file: dependencies were incorrectly classified as external in the isolated reifier, routing them through store extraction instead of symlinking directly. This caused the relative path to resolve from the wrong directory, producing ENOENT errors. Treat file dep targets found in fsChildren as local dependencies, alongside workspaces, so they get symlinked directly.
c7311a1 to
35c957a
Compare
wraithgar
approved these changes
Mar 4, 2026
wraithgar
pushed a commit
that referenced
this pull request
Mar 4, 2026
This contains the changes from - a2154cd (#8996) - 880ecb7 (#9013) - 26fa40e (#9041) - 983742b (#9055) - 10d5302 (#9051) - a29aeee (#9028) - 16fbe13 (#9030) - 8614b2a (#9031) Since Node 22 doesn't have npm 11 yet, it would be better to have this change backported to v10 Also, we wish to use `install-strategy=linked` in the [Gutenberg monorepo](WordPress/gutenberg#75814), which powers the WordPress Block Editor. We are still on v10. So, these fixes will help.
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.
In continuation of our exploration of using
install-strategy=linkedin the Gutenberg monorepo, which powers the WordPress Block Editor, this is a follow up of the fixes from #8996.When using
install-strategy=linked, relativefile:dependencies (e.g.,file:./project2) fail with ENOENT because the path is resolved one level above the project root. For example,file:./project2becomesfile:../project2, causing npm to look for/Users/dan/Source/project2instead of/Users/dan/Source/project1/project2.In the isolated reifier, non-workspace
file:dependencies are incorrectly classified as "external" dependencies. This routes them through the store extraction path (pacote.extract) instead of symlinking them directly like workspaces. A Link node'sresolvedvalue is relative to itsnode_modules/location — that relative path becomes invalid when used from the store context.This PR treats local
file:dep targets found infsChildrenas local dependencies (alongside workspaces) so they get symlinked directly instead of extracted into the store:_makeIdealGraph: Skip nodes fromroot.externalif they (or their Link target) are inidealTree.fsChildren.assignCommonProperties: Classify deps whose targets are innode.fsChildrenas local dependencies instead of external.References
Fixes #7549