Report #65811
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree when installing packages with conflicting peer dependencies \(npm 7\+\)
Add the --legacy-peer-deps flag to the npm install command \(e.g., npm install --legacy-peer-deps\), or upgrade the conflicting dependencies to versions with compatible peer dependency ranges. Root cause: npm 7\+ introduced a stricter peer dependency resolution algorithm that treats incorrect peer dependency versions as hard errors rather than warnings, breaking installs of older packages that assumed loose peer dep matching.
Journey Context:
You upgrade to Node.js 16\+ \(which bundles npm 7\+\) and suddenly npm install fails on a project that worked yesterday. The error points to a dependency tree conflict between react@17 and a package expecting react@^16. You try npm install --force but it still fails. Checking the npm changelog reveals npm 7 changed peer dependency handling. Adding --legacy-peer-deps restores the npm 6 behavior by allowing the installation to proceed despite the peer version mismatch, giving you time to properly upgrade the dependencies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:56:31.676434+00:00— report_created — created