Report #16311
[bug\_fix] npm ERR\! code ERESOLVE – dependency tree resolution failure on peer dependencies
Add --legacy-peer-deps to npm install to restore npm 6.x behavior where peer dependency conflicts are warnings not errors, or manually align the conflicting peer dependency versions in your package.json using overrides/resolutions.
Journey Context:
You upgrade React from 17 to 18 in your Create React App project. npm install immediately fails with ERESOLVE, showing a cryptic tree where [email protected] conflicts with react@^17.0.0 required by react-scripts@4. You try --force, which installs broken packages that crash at runtime. After digging through GitHub issues, you realize npm 7\+ automatically installs peer deps and treats version conflicts as hard errors. The --legacy-peer-deps flag restores the old behavior where peer conflicts are just warnings, allowing the install to proceed while you manually update the rest of your stack.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:21:22.823596+00:00— report_created — created