fix(arborist): preserve failed targets while loading peer sets by drewmt · Pull Request #10150 · npm/cli · GitHub
Skip to content

fix(arborist): preserve failed targets while loading peer sets - #10150

Open
drewmt wants to merge 1 commit into
npm:latestfrom
drewmt:fix/failed-peer-load-loop
Open

drewmt wants to merge 1 commit into
npm:latestfrom
drewmt:fix/failed-peer-load-loop

Conversation

@drewmt

@drewmt drewmt commented Oct 21, 2026

Copy link
Copy Markdown

An unavailable direct dependency can be repeatedly replaced by a valid version requested by a transitive peer. Its original edge then reinstalls the failed, versionless node, so npm install --package-lock-only never reaches the load-error reporting phase.

Keep an already failed target in the real tree while loading subsequent peer sets. The existing pruning phase can then report its original ETARGET, or mark the optional peer-dependent group inert. Valid peer targets continue through the existing resolution path. This does not add an iteration limit or change dependency versions.

The regression includes the transitive react-shallow-renderer peer from the report, with required and optional dependencies under default, strict and force modes.

Validation

  • On unmodified 12.2.1, the reported CLI reproduction did not terminate within 20 seconds; the one-peer control returned ETARGET in 394 ms. The mock-registry regression also timed out before the fix.
  • After the change, the reproduction returns the original ETARGET in 671 ms on Node 26.8.1 and 584 ms on Node 24.19.0. The valid-version control succeeds.
  • Full Arborist npm test: all 59 test files pass with 100% statement, branch, function and line coverage, including lint and package template checks (Node 24.19.0). No upstream CI result is claimed here.
  • Root CLI tests: 6027 passing, 22 skipped, 100% coverage. The command's postlint template checker fails on workflow branch-template differences also reproduced on clean base ae98c62586b6fea44114f72e249e246a2981de70; no tooling changes are included.

References

Fixes #10149

@drewmt
drewmt requested a review from a team as a code owner October 21, 2026 11:16
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 never finishes when a dependency has no matching version and two packages peer on it (11.21.1, 12.2.1)

1 participant