Skip to content

feat: add auto-install-peers to opt out of auto-installing peer dependencies - #10049

Open
manzoorwanijk wants to merge 9 commits into
npm:latestfrom
manzoorwanijk:feat/auto-install-peers
Open

manzoorwanijk wants to merge 9 commits into
npm:latestfrom
manzoorwanijk:feat/auto-install-peers

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

With auto-install-peers=false, npm stops adding a package only to satisfy a dependency's required peer, and instead reports every package that depends on a package with a required peer without declaring that peer itself.
Reports are EPEERUNDECLARED warnings; under strict-peer-deps, violations by the root or a workspace fail the install unless --force is set.

  • Placement skips such peers in #problemEdges and #loadPeerSet, and prunes ones already locked (build-ideal-tree.js).
  • The rule reads manifests, so all install strategies report the same result (peer-declarations.js).
  • npm ci rejects a lockfile that still contains auto-installed peers.
  • Third-party violations can be fixed with packageExtensions or .npm-extension.
  • An optional peer of the root does not install a required peer, and a present optional peer counts as a declaration.
  • A dependent that declares a peer it does not install passes that peer's own peers to its consumer, so any declaration of them counts.

References

Implements npm/rfcs#926

@manzoorwanijk
manzoorwanijk force-pushed the feat/auto-install-peers branch from 2661eda to 4654bb5 Compare October 2, 2026 08:15
@manzoorwanijk
manzoorwanijk marked this pull request as ready for review October 6, 2026 12:29
@manzoorwanijk
manzoorwanijk requested a review from a team as a code owner October 6, 2026 12:29
@manzoorwanijk
manzoorwanijk force-pushed the feat/auto-install-peers branch 2 times, most recently from ec55f79 to c81a1cd Compare October 15, 2026 04:10
@manzoorwanijk
manzoorwanijk force-pushed the feat/auto-install-peers branch from c81a1cd to 9d22e2d Compare October 16, 2026 06:48
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.

1 participant