Report #83097
[bug\_fix] npm ERR\! ERESOLVE could not resolve dependency tree - peer dependency conflict
Run npm install with --legacy-peer-deps flag, or update the conflicting packages to versions with compatible peer dependency ranges. Root cause: npm 7\+ enforces strict peer dependency resolution \(installing them by default\), whereas npm 6 silently ignored peer conflicts.
Journey Context:
Developer upgrades to Node.js 18 which bundles npm 9. Cloning a legacy React 17 project, they run npm install. Instead of installing, npm throws ERESOLVE citing that [email protected] requires react@^17.0.2 but an old [email protected] has a peer dependency on react@^16.8.0. Developer tries deleting node\_modules but the error persists. Searching reveals npm 7 changed peer dep resolution. The immediate fix --legacy-peer-deps restores npm 6's lenient behavior allowing the install. However, the proper fix is upgrading react-router-dom to v6 which supports React 18, eliminating the peer conflict at the source.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:04:18.237785+00:00— report_created — created