Report #38465
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps flag to npm install or npm ci, or manually align peer dependency versions to satisfy the strict tree
Journey Context:
Developer upgrades from npm 6 to npm 7 or 8. Running npm install on an existing project suddenly throws ERESOLVE, listing a conflict where package A requires React 17, but package B requires React 18 as a peer dependency. npm 7\+ automatically installs peer dependencies by default, causing impossible trees that npm 6 ignored. The developer tries --force which installs but causes runtime errors. Checking npm ls reveals the strict peer dep resolution is the culprit. The real fix is --legacy-peer-deps to restore npm 6 behavior, or manually upgrading the conflicting package. This works because npm 7\+ introduced strict peer dependency resolution per RFC 25; the legacy flag disables the Arborist engine's strict peer dependency checks, treating them as optional hints rather than hard constraints that must form a valid tree.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:02:17.331241+00:00— report_created — created