fix(arborist): handle npm link with install-strategy=linked#9167
Open
manzoorwanijk wants to merge 1 commit intonpm:latestfrom
Open
fix(arborist): handle npm link with install-strategy=linked#9167manzoorwanijk wants to merge 1 commit intonpm:latestfrom
npm link with install-strategy=linked#9167manzoorwanijk wants to merge 1 commit intonpm:latestfrom
Conversation
6d9bdb8 to
3f0b5f8
Compare
Contributor
Author
|
@wraithgar I am not sure why CI fails with |
Contributor
don't worry about that, it is unrelated: nodejs/node#62425 |
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.npm linkis completely broken withinstall-strategy=linked.Both
npm link <path>andnpm link <pkg>(via global) crash withENOENTbecause the isolated reifier tries to extract the linked package into.store/instead of symlinking it.The root cause is that
npm linkcreates afile:dependency pointing outside the project root.The Link node ends up in
idealTree.children(notfsChildren) because its path isroot/node_modules/<name>.The isolated reifier doesn't recognize it as a local dependency, so it routes it through
#externalProxywhich tries to extract it into the store.The
file:relative path then gets resolved from the store entry location instead of the project root, producing a wrong absolute path.The fix detects Link nodes with
file:resolved paths and treats them as workspace-like local dependencies.Instead of extracting into
.store/, they get symlinked directly innode_modules/, matching the behavior of the hoisted strategy.References
Fixes #9166