Report #16702
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Run npm install with --legacy-peer-deps flag, or add legacy-peer-deps=true to .npmrc. Root cause: npm v7\+ automatically installs peer dependencies by default, which conflicts when different packages in the tree require incompatible versions of the same peer \(e.g., React 17 vs 18\). The flag reverts to npm v6 behavior where peer deps are not auto-installed, leaving resolution to the developer.
Journey Context:
You just upgraded to Node 18 and ran npm install on a legacy React 17 project. Suddenly the terminal explodes with ERESOLVE errors citing conflicts between [email protected] and [email protected]. You try deleting node\_modules and package-lock.json, but the error persists. You Google and find GitHub issues explaining that npm v7 changed peer dependency handling. You try --force, which installs but creates runtime crashes. Finally, you discover --legacy-peer-deps in the npm RFC documentation, which restores the v6 behavior. The install succeeds because npm stops trying to auto-resolve the React version conflict and trusts your explicit dependencies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:19:57.828417+00:00— report_created — created