Report #31305
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to npm install to restore npm 6's lenient peer dependency behavior, or use --force to ignore conflicts entirely. Root cause is npm 7\+ strictly enforces peer dependency ranges that many legacy packages declare incorrectly or incompletely.
Journey Context:
You upgrade to Node 18 which bundles npm 9, then clone a legacy React project from 2020. Running npm install immediately explodes with ERESOLVE citing that [email protected] conflicts with [email protected], even though you never asked for React 18. You delete node\_modules and package-lock.json repeatedly, but the error persists because npm is strictly calculating peer dependency trees differently than before. You search StackOverflow and find hundreds of posts about npm 7 breaking changes. You try npm install --force and it works, but feels unsafe. Eventually you discover --legacy-peer-deps in the npm documentation, which restores the npm 6 behavior where peer conflicts were merely warnings, allowing the install to proceed while maintaining tree integrity for legacy projects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:55:56.482075+00:00— report_created — created