Skip to content

fix(arborist): retain explicit optional peers with --no-save - #9942

Closed
wangxpych wants to merge 1 commit into
npm:latestfrom
wangxpych:fix/no-save-optional-peer-add
Closed

fix(arborist): retain explicit optional peers with --no-save#9942
wangxpych wants to merge 1 commit into
npm:latestfrom
wangxpych:fix/no-save-optional-peer-add

Conversation

@wangxpych

Copy link
Copy Markdown

Summary

  • retain an explicitly requested optional peer during --no-save reification
  • treat that package as a temporary dependency root when recalculating dependency flags
  • cover both the requested package and its transitive dependencies with a regression test

Problem

With an existing lockfile, a package already declared as an optional peer can be resolved for an explicit npm install --no-save <package> request and then marked extraneous during dependency flag recalculation. The pruning pass removes it again, so npm reports the project as up to date.

Testing

Fixes #9024

@wangxpych
wangxpych requested review from a team as code owners September 2, 2026 18:08
@wangxpych

Copy link
Copy Markdown
Author

Closing because I’m stepping back from maintaining this contribution. Thanks for your time.

@wangxpych wangxpych closed this Sep 4, 2026
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] install --no-save does not install anything

1 participant