fix: keep nested file: deps and re-resolve changed git refs#9523
Merged
Conversation
Comment on lines
+914
to
+915
| if (node.extraneous && !/(^|\/)node_modules\//.test(loc) && loc !== 'node_modules' && | ||
| (!node.fsParent || node.fsParent.isRoot)) { |
06cfb41 to
d9eeec9
Compare
d9eeec9 to
de72e81
Compare
nishantms
reviewed
Jun 10, 2026
nishantms
approved these changes
Jun 10, 2026
Contributor
|
🎉 Backport to |
owlstronaut
added a commit
that referenced
this pull request
Jun 10, 2026
Backport of #9523 to `release/v11`. Co-authored-by: Michael Smith <owlstronaut@github.com>
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.
The lockfile pruning added in 11.15.0 dropped every extraneous node outside node_modules to remove stale workspace entries. This also removed legitimate nested entries for a file: dependency that itself has a file: dependency (e.g. lib/b/lib/a), leaving the lockfile incomplete so
npm cifailed with "Missing: a@1.0.0 from lock file".Only prune extraneous nodes that are direct fsChildren of the root or detached link targets (removed workspaces, removed root-level file: deps, orphaned link targets). Extraneous fsChildren nested under another package are kept so
npm cican resolve the parent's dependency.Fixes: #9433
Fixes: #9486
Supersedes: #9524