Report #35493
[bug\_fix] npm ERR\! ERESOLVE could not resolve
Add the --legacy-peer-deps flag to the install command, or explicitly override the peer dependency resolution by adding the conflicting peer dependency to your own package.json dependencies. The root cause is that npm v7\+ automatically installs peer dependencies by default, which can create impossible version ranges when two packages require incompatible versions of the same peer \(e.g., React 17 vs 18\).
Journey Context:
You upgrade to Node.js 18 and run npm install on a project that worked fine on Node 14. Suddenly the terminal fills with red ERESOLVE errors mentioning conflicting peer dependencies for react and react-dom. You try npm audit fix --force out of habit, which downgrades packages and breaks the build further. Digging into the npm docs, you realize npm 7 changed the peer dependency resolution algorithm to auto-install peers, which causes collisions when PackageA expects React 17 and PackageB expects React 18. The --legacy-peer-deps flag restores the npm 6 behavior where peer dependencies are not automatically installed, allowing the install to proceed while you manually reconcile the versions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T14:02:56.547911+00:00— report_created — created