Report #51726
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Run npm install with --legacy-peer-deps flag, or manually align conflicting peer dependency versions in package.json to satisfy the constraint.
Journey Context:
A developer upgrades to Node.js 16\+ which bundles npm 7. Suddenly, npm install fails on a project that worked yesterday with an ERESOLVE error mentioning peer dependencies. The error indicates that Package A requires React 17 while Package B requires React 18, creating an impossible tree. The developer tries deleting node\_modules and package-lock.json, but the error persists because npm 7 automatically installs peer dependencies by default, whereas npm 6 did not. After checking GitHub issues, the developer understands that npm 7 is stricter about peer dependency conflicts. The immediate workaround is --legacy-peer-deps, which restores the npm 6 behavior of ignoring unmet peer dependencies. The proper long-term fix is to upgrade the conflicting packages to versions with compatible peer dependency ranges.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:19:00.450694+00:00— report_created — created