Report #100066
[bug\_fix] npm ERR\! code ERESOLVE — could not resolve dependency tree due to peer dependency conflict
Run the install with the \`--legacy-peer-deps\` flag \(e.g. \`npm install --legacy-peer-deps\`\) or add \`legacy-peer-deps=true\` to \`.npmrc\`. This restores the npm 6 behavior of ignoring peer-dependency version conflicts during resolution. The real fix is to upgrade the conflicting package\(s\) so their peer ranges agree, but \`--legacy-peer-deps\` is the established escape hatch when upstream has not caught up.
Journey Context:
You upgraded to Node 18 and npm 9, cloned a repo that worked last year, and \`npm install\` now explodes with \`ERESOLVE\` naming two React-related packages that declare incompatible peer ranges. You try \`npm install --force\`, which resolves the tree but installs duplicates and breaks hooks at runtime. You pin React back, but another transitive dependency demands the newer one. After reading the npm docs you realize npm 7\+ changed the peer-dependency resolver to be strict by default; the conflict was always latent but npm 6 silently ignored it. Passing \`--legacy-peer-deps\` tells the resolver to skip peer-conflict enforcement, giving you a buildable tree while you file upstream issues to align peer ranges.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-01T04:35:51.078615+00:00— report_created — created