Skip to content

fix: workspace-filtered install with linked strategy#9041

Merged
owlstronaut merged 1 commit intolatestfrom
owlstronaut/fix-install-links
Mar 2, 2026
Merged

fix: workspace-filtered install with linked strategy#9041
owlstronaut merged 1 commit intolatestfrom
owlstronaut/fix-install-links

Conversation

@owlstronaut
Copy link
Contributor

@owlstronaut owlstronaut commented Feb 27, 2026

The isolated tree created by _createIsolatedTree() used Arrays and plain objects incompatible with workspace-filtered installs. This caused crashes when using --workspace with --install-strategy=linked, broken since the linked strategy was introduced in npm 9.4.0.

  • Use Map/Set for children, fsChildren, and inventory to match real Node tree interfaces
  • Add workspaces Map, workspace Link entries in children, and a working inventory.query('realpath', ...) implementation
  • Fix diff.js filterSet builder to visit link targets so store entries are included in workspace-scoped diffs
  • Skip re-rooting for linked strategy (filterSet references don't survive the tree-swap)
  • Remove dead .get && guard on children (now a proper Map)

Fixes: #9038

@owlstronaut owlstronaut force-pushed the owlstronaut/fix-install-links branch 2 times, most recently from 241f4d2 to ea19365 Compare February 27, 2026 19:19
@owlstronaut owlstronaut marked this pull request as ready for review February 27, 2026 19:24
@owlstronaut owlstronaut requested a review from a team as a code owner February 27, 2026 19:24
@owlstronaut
Copy link
Contributor Author

@manzoorwanijk Could you give this a try?

Copy link
Contributor

@manzoorwanijk manzoorwanijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave it a test and it works great. Thanks.

@wraithgar wraithgar changed the title fix: fix workspace-filtered install with linked strategy fix: workspace-filtered install with linked strategy Mar 2, 2026
@owlstronaut owlstronaut force-pushed the owlstronaut/fix-install-links branch from ea19365 to a37efed Compare March 2, 2026 17:34
@owlstronaut owlstronaut merged commit 26fa40e into latest Mar 2, 2026
16 checks passed
@owlstronaut owlstronaut deleted the owlstronaut/fix-install-links branch March 2, 2026 17:47
package: workspace.package,
linksIn: new Set(),
}
root.children.set(wsLink.name, wsLink)
Copy link
Contributor

@manzoorwanijk manzoorwanijk Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have introduced a new bug that creates duplicate symlinks and fails with EEXIST. I am investigating the issue. I will file a bug report when I find the cause.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turned out to be a different bug - #9050

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] npm install --workspace crashes with install-strategy=linked

3 participants