Report #12519
[bug\_fix] npm ERR\! ERESOLVE could not resolve dependency tree - conflicting peer dependencies
Add --legacy-peer-deps to npm install or npm ci, or explicitly install the conflicting peer dependencies with compatible versions
Journey Context:
Developer upgrades to npm v7\+ or clones a legacy React project and runs npm install. Instead of warnings, the install hard-fails with ERESOLVE, citing that PackageA requires react@^17.0.0 while PackageB requires react@^18.0.0. The rabbit hole involves inspecting node\_modules, checking if resolutions can force a single version, realizing it's a diamond dependency conflict where npm v7\+ treats peer dependency conflicts as fatal errors rather than warnings. Adding --legacy-peer-deps tells npm to restore the v6 behavior where peer dependency conflicts are ignored during installation, allowing the tree to resolve arbitrarily. This works because it disables the strict peer dependency resolution algorithm that validates the entire tree's peer satisfaction at install time, deferring runtime compatibility to the developer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:14:36.028306+00:00— report_created — created