Report #68947
[bug\_fix] npm ERR\! ERESOLVE could not resolve dependency tree
Run npm install with --legacy-peer-deps to restore npm 6 behavior, or manually upgrade/downgrade conflicting peer dependencies to compatible ranges. Root cause: npm 7\+ automatically installs peer dependencies; when two packages require incompatible versions of the same peer \(e.g., React 17 vs 18\), the resolver cannot satisfy both.
Journey Context:
You upgrade Node.js to v16 or v18, which ships npm 7\+. Running npm install on a working project suddenly throws ERESOLVE complaining that package A requires React 17 while package B requires React 18. You delete node\_modules and package-lock.json, but the error persists. You search GitHub and find npm/cli issue \#2619 explaining the peer auto-install breaking change. You try --force which installs but creates runtime bugs. Finally you discover --legacy-peer-deps which restores the npm 6 resolution algorithm, allowing the install to succeed without changing source code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T22:12:44.168474+00:00— report_created — created