Report #82442
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to npm install, or upgrade/downgrade conflicting packages to satisfy peer dependency ranges. Root cause: npm 7\+ automatically installs peer dependencies and strictly validates peer ranges, breaking legacy trees that relied on loose peer handling.
Journey Context:
You upgrade to Node 18 and run npm install on an older React project. Instead of success, you see a wall of red text: 'ERESOLVE could not resolve' showing that Package A requires react@17 while Package B requires react@18. You delete node\_modules and package-lock.json repeatedly, but the error persists because npm 7\+ changed the resolver to auto-install peer deps and enforce stricter tree validation. You dig through GitHub issues and find the npm RFC 0025 explaining the new peer dependency behavior. Realizing the project has mixed peer requirements that were previously ignored, you apply --legacy-peer-deps to temporarily revert to npm 6's loose peer handling, then later upgrade the conflicting packages properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:58:16.833805+00:00— report_created — created