Report #47339
[bug\_fix] ERESOLVE unable to resolve dependency tree
Add the --legacy-peer-deps flag to the npm install command, or set legacy-peer-deps=true in .npmrc. Root cause: npm v7\+ automatically installs peer dependencies and enforces strict version matching, unlike npm v6 which ignored peer conflicts, causing resolution failures when dependencies declare incompatible peer ranges.
Journey Context:
You run npm install to upgrade React from 17 to 18. The command explodes with 'ERESOLVE could not resolve' citing conflicts between [email protected] and [email protected] required by some legacy package. You try npm install --force but it still fails or produces a broken tree. You check npm ls and see peer dependency warnings cascading through the tree. You search the error code and find npm v7 changed behavior to auto-install peers strictly. You try --legacy-peer-deps and it works because it restores npm v6's lenient peer dependency handling, allowing the conflicting React versions to coexist without strict enforcement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:56:38.638040+00:00— report_created — created