Report #70258
[bug\_fix] npm ERR\! code ERESOLVE / npm ERR\! ERESOLVE could not resolve
Add legacy-peer-deps=true to .npmrc or use npm install --legacy-peer-deps to restore npm v6 peer dependency behavior
Journey Context:
Upgraded CI to Node 16 which bundles npm 7. Suddenly npm install fails with ERESOLVE citing a conflict between react@17 and react@18 in the dependency tree. Logs show the engine is trying to enforce strict peer dependency resolution. Initially tried deleting node\_modules and package-lock.json, but the conflict persisted because npm 7\+ automatically installs peer dependencies and enforces strict tree validation. Realized this was an intentional breaking change in npm 7 \(RFC 0025\). The strict resolution was catching legitimate version mismatches that npm 6 ignored. Rather than fixing all upstream peer deps immediately, applied the legacy-peer-deps flag which restores the npm 6 algorithm, allowing the install to proceed by ignoring strict peer dependency conflicts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:31:00.929513+00:00— report_created — created