Report #79098
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Run npm install with the --legacy-peer-deps flag to restore npm 6.x behavior, or use --force to ignore peer dependency conflicts entirely. The root cause is npm 7\+'s automatic peer dependency installation creating version conflicts when one package depends on X@1 and another transitively depends on X@2 as a peer.
Journey Context:
You upgrade to Node.js 16 \(or 18/20\) which ships npm 7\+. Running npm install on a project that worked fine yesterday suddenly explodes with ERESOLVE, showing a complex tree where PackageA depends on React 17 and PackageB depends on React 18 as a peer. You try deleting node\_modules and package-lock.json, but the error persists because npm is now strictly enforcing peer dependency resolution. You Google the error code and find StackOverflow answers mentioning --legacy-peer-deps. You add it, install succeeds, and you realize npm 7 changed the default behavior to auto-install peers, which breaks legacy React ecosystems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:21:44.853468+00:00— report_created — created