Report #22616
[bug\_fix] npm ERR\! code ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to npm install or set legacy-peer-deps=true in .npmrc to restore npm 6 peer dependency resolution behavior.
Journey Context:
Developer upgrades from npm 6 to npm 7/8/9 and suddenly \`npm install\` fails with ERESOLVE despite working previously. Deleting node\_modules and package-lock.json doesn't help. Examining the error reveals conflicting peer dependency requirements \(e.g., React 17 vs 18\) between different packages. Realizing npm 7 introduced strict peer dependency enforcement per RFC 25, the developer understands that the resolver now treats peer conflicts as hard constraints rather than warnings. Adding --legacy-peer-deps instructs the resolver to ignore peer dependency violations, reverting to npm 6's warning-only behavior and allowing installation to proceed while accepting potential runtime incompatibilities.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:22:08.241124+00:00— report_created — created