Skip to content

fix: fix workspace-filtered install with linked strategy#9041

Open
owlstronaut wants to merge 1 commit intolatestfrom
owlstronaut/fix-install-links
Open

fix: fix workspace-filtered install with linked strategy#9041
owlstronaut wants to merge 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 from 10626cb to 241f4d2 Compare February 27, 2026 19:09
@owlstronaut owlstronaut force-pushed the owlstronaut/fix-install-links branch 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.

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

2 participants