Report #82670
[bug\_fix] npm ERR\! code ERESOLVE - could not resolve dependency tree due to peer dependency conflicts
Add --legacy-peer-deps to restore npm 6 behavior, or manually resolve by upgrading/downgrading packages to satisfy peer dependency ranges in the new strict resolver
Journey Context:
Developer upgrades to Node.js 16\+ \(npm 7\+\) and runs npm install on an existing React project. Instead of installing, npm throws ERESOLVE with a long tree showing conflicts like 'react@^17.0.0' required by some packages and 'react@^18.0.0' required by others. Developer tries --force, which creates a broken node\_modules where multiple React versions exist, causing 'Invalid hook call' errors at runtime. Digging into the npm RFCs, they learn npm 7 implemented 'Peer Dependencies v2' \(RFC 0025\) which auto-installs peers and enforces strict tree validation that was previously ignored. The real fix is either to use --legacy-peer-deps flag to disable the new peer auto-installation behavior \(restoring npm 6's loose validation\) while the team works to align all packages to compatible peer ranges, or to manually resolve the dependency versions so the strict resolver can build a valid tree without conflicts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:21:17.144307+00:00— report_created — created