fix(arborist): report ETARGET instead of ERESOLVE for unresolvable peer targets #10118

Merged
github-actions[bot] opened 11:57am on October 12, 2026 wanted to merge 1 commit into npm/cli release/v11 from
backport/v11/9987

Pull Request Overview

  • Opened on October 12, 2026
  • Status Merged
  • Commit count 1 with first commit October 9, 2026

Total Delta

0 Total Diff Delta

Open Days

Open 19 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
N/A 18.9 days Issue creation to work beginning
 
1.0 day Authoring 1 commit before pull request opened for review
 
1.0 day Awaiting first review
 
1.0 day Revising work with 0 commits in response to 2 reviews that left 0 comments
 
1.0 day Merge to deploy

Total time for pull request 4.0 business days from first commit authored to deploy

Author avatar

fix(arborist): report ETARGET instead of ERESOLVE for unresolvable peer targets

Backport of #9987 to release/v11.

Is there an existing issue for this?

  • [x] I have searched the existing issues

This issue exists in the latest npm version

  • [x] I am using the latest npm

This is not just a request to bump a dependency for a CVE

  • [x] This is not solely a request to bump a dependency for a CVE

Current Behavior

When a root dependency has no matching version (e.g. every match is younger than min-release-age/before, or the range does not exist) and another dependency peers on it, npm fails with ERESOLVE ... Found: react@undefined. The real ETARGET is never shown, so users chase a nonexistent peer conflict. Seen in a large monorepo with min-release-age=1 and a freshly published webpack.

Expected Behavior

ETARGET No matching version found for react@^18.3.0 with a date before ..., as npm prints without the peer dependent or with --legacy-peer-deps.

Steps To Reproduce

mkdir x && cd x
printf '{"name":"x","version":"1.0.0","dependencies":{"react":"^18.3.0","react-dom":"18.2.0"}}' > package.json
npm install --package-lock-only --before=2024-01-01   # expected: ETARGET; actual: ERESOLVE Found: react@undefined
npm install --package-lock-only --before=2024-01-01 --legacy-peer-deps   # ETARGET (correct)
npm pkg set dependencies.react=^99.0.0
npm install --package-lock-only   # expected: ETARGET; actual: ERESOLVE Found: react@undefined

Environment

  • npm: 12.0.2 and latest source (c9876d7ea); also npm 10.9.2
  • Node.js: v24.18.0
  • OS Name: macOS Darwin 25.6.0
  • npm config: none required (min-release-age flattens to before)

PR was closed without comments.