Report #24090
[bug\_fix] ERESOLVE unable to resolve dependency tree
Add the --legacy-peer-deps flag to npm install \(e.g., npm install --legacy-peer-deps\). Root cause: npm v7\+ implemented strict peer dependency resolution per RFC 25, whereas npm v6 silently ignored peer conflicts. This flag restores the legacy \(v6\) peer dependency behavior, allowing installation despite version mismatches.
Journey Context:
You clone a legacy React 17 project and run npm install using Node 18 \(which includes npm 8\). The install crashes immediately with ERESOLVE, citing a conflict between react@17 and react@18 required by a sub-dependency. You delete node\_modules and package-lock.json, thinking it's a cache issue, but the error persists. You examine the dependency tree and realize npm is enforcing strict peer resolution. Searching the error leads you to npm RFC 25 and the documentation for --legacy-peer-deps. You run npm install --legacy-peer-deps, the install completes, and the application runs correctly without forcing you to upgrade React immediately.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:50:33.099461+00:00— report_created — created