Report #83338
[bug\_fix] ERESOLVE unable to resolve dependency tree \(peer dependency conflict\)
Add --legacy-peer-deps to npm install command or set legacy-peer-deps=true in .npmrc to restore npm 6.x peer dependency resolution behavior, allowing the install to proceed with warnings instead of hard errors
Journey Context:
You upgrade to npm 7\+ or clone a legacy project. Running npm install suddenly throws ERESOLVE with a long dependency tree showing conflicting peer dependencies, often React versions. You try deleting node\_modules and package-lock.json, but the error persists because npm 7 automatically installs peer dependencies and strictly enforces version matching. Searching reveals npm 7 introduced a stricter resolution algorithm. After testing, you realize the project was built assuming npm 6's looser peer dep handling. Adding --legacy-peer-deps to your install command bypasses the strict peer dependency resolution, allowing the install to proceed with warnings instead of hard errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:28:22.358830+00:00— report_created — created