`npm update react --package-lock-only` fails with ERESOLVE where `npm update --package-lock-only` succeeds

Aperta
#10,257 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Doomguy-BFG9000 ci sta già lavorando.

Dal 8/11/2026.

  • #10262 di @Doomguy-BFG9000 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
cli, devtools

Direzione di ricerca

Start by reproducing the failure in npm 11.19.0 with the supplied repository commit and compare the named-package update with the bare update. Trace how npm resolves peer dependencies when package names are supplied to npm update --package-lock-only, then identify the relevant tests and add coverage for this lockfile-only case. Done means naming react succeeds and preserves the root pin at 18.3.1.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:peer-dependencies Bug cmd:update Priority 2

Environment

  • npm 11.19.0, node v24.21.0, Linux x86_64

Steps to reproduce

Public repo storytold/artcraft at 1f969a9224934a55417daf10359a6fb1458b63f4, directory frontend/. The root package.json pins "react": "18.3.1" exactly. The workspace apps/artcraft depends on "react": "^18.2.0" and "@preact/signals-react": "^2.0.1", whose peer range is react@"^16.14.0 || 17.x || 18.x || 19.x".

git clone https://github.com/storytold/artcraft && cd artcraft/frontend
git checkout 1f969a9224934a55417daf10359a6fb1458b63f4

npm update --package-lock-only --ignore-scripts         # exit 0
git checkout -- package-lock.json
npm update react --package-lock-only --ignore-scripts   # exit 1, ERESOLVE

Expected

Naming react updates no more than a plain npm update does. The project's own react requirements are 18.3.1 (root) and ^18.2.0 (workspace), so the result should keep react 18.3.1, as plain npm update does without error.

Actual

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error While resolving: @preact/[email protected]
npm error Found: [email protected]
npm error   react@"18.3.1" from the root project
...
npm error Conflicting peer dependency: [email protected]
npm error   peer react@"^16.14.0 || 17.x || 18.x || 19.x" from @preact/[email protected]
npm error   apps/artcraft/node_modules/@preact/signals-react

With react named, npm appears to choose [email protected] (the latest the peer range allows) for the peer edge, then rejects it against the root's exact pin. Naming react-dom or @preact/signals-react alone succeeds.

Context

We name every declared registry package (npm update a b c ...) instead of running a bare npm update so that Git dependencies stay at their locked commits. That makes the named form the only one available to us when a lock has Git dependencies.


Found by an automated test of a dependency-update tool across public repositories.

Lingua principale
JavaScript
Stelle
10.3k
Fork
5k
Merge medio
4g 11h
PR unite (30g)
26

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di npm/cli

Tutte le issue di npm/cli

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.