GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(arborist): clean up stale .store and hoisted dirs on strategy switch by manzoorwanijk · Pull Request #9647 · npm/cli

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

In continuation of our exploration of using install-strategy=linked in the Gutenberg monorepo, which powers the WordPress Block Editor.

Switching install-strategy in the same project directory left behind the previous strategy's layout. Going hoisted → linked kept the stale real top-level transitive directories alongside the new .store/ and symlinks; going linked → hoisted kept the entire node_modules/.store/ directory. A fresh install of either strategy was already clean — only the switch was affected.

Why

Under the linked strategy the actual tree the diff compares against is synthesized from the ideal tree (#buildLinkedActualForDiff), so real directories left over from a prior hoisted layout are never seen, and #cleanOrphanedTopLevelLinks only removed symlinks. In the other direction load-actual ignores dot-directories, so the hoisted diff never sees node_modules/.store and never removes it.

How

reify.js now removes the leftover .store on a non-linked reify via #removeStaleStoreDir. The store lives only at the project root and is exclusively a linked artifact, so a single removal covers the project. It runs only for a full-project install — a workspace-filtered or --workspaces=false install is skipped, because out-of-scope workspaces may still link into the store.

#cleanOrphanedTopLevelLinks (run only under linked) additionally removes stale real package directories — a directory containing a package.json that is not in the ideal tree's valid top-level set — and prunes an emptied @scope directory afterward. Non-package real directories and symlinks pointing outside the project are still preserved.

The valid-top-level collection in #cleanOrphanedStoreEntries no longer skips non-link nodes, so the root's bundled dependencies — materialized as real top-level directories under linked — are recorded as valid and never swept as stale.

References

Fixes #9615
Part of #9608

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
manzoorwanijk added 2 commits June 25, 2026 00:50
@manzoorwanijk
fix(arborist): clean up stale .store and hoisted dirs on install-stra…
414f097
…tegy switch
@manzoorwanijk
test(arborist): assert workspace store link survives a partial install
3eef92c
@manzoorwanijk
manzoorwanijk marked this pull request as ready for review June 24, 2026 19:28
@manzoorwanijk
manzoorwanijk requested review from a team as code owners June 24, 2026 19:28
owlstronaut
owlstronaut approved these changes Jun 24, 2026
View reviewed changes
@owlstronaut
owlstronaut merged commit ca92323 into npm:latest Jun 24, 2026
22 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@owlstronaut owlstronaut added the backport:v11 label Jun 24, 2026
@github-actions github-actions Bot mentioned this pull request Jun 24, 2026
fix(arborist): clean up stale .store and hoisted dirs on strategy switch #9649
Merged
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #9649

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Jun 24, 2026
chore: release 12.0.0-pre.2 #9594
Merged
owlstronaut pushed a commit that referenced this pull request Jun 24, 2026
@github-actions @manzoorwanijk
fix(arborist): clean up stale .store and hoisted dirs on strategy swi…
4c9eacb
…tch (#9649)

Backport of #9647 to `release/v11`.

Co-authored-by: Manzoor Wani <[email protected]>
@manzoorwanijk
manzoorwanijk deleted the fix/linked-strategy-switch-cleanup branch June 26, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@owlstronaut owlstronaut owlstronaut approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

backport:v11

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG] install-strategy=linked: .store and stale directories not cleaned up when switching install strategy

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@manzoorwanijk @owlstronaut
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.