Report #85724
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree \(peer dependency conflict\)
Add the --legacy-peer-deps flag to npm install to restore npm v6 behavior, or manually align conflicting peer dependency versions \(e.g., ensure a single React version satisfies all packages\).
Journey Context:
A developer upgrades npm from v6 to v7\+ \(or installs Node 16\+\) and suddenly cannot install dependencies that previously worked. The error log shows ERESOLVE and details that Package X requires React@^17 while Package Y requires React@^18. The developer tries --force, which risks incompatible package combinations. Investigating, they learn npm 7\+ automatically installs peer dependencies by default, causing version conflicts when different packages demand different peer versions. Using --legacy-peer-deps tells npm to ignore peer dependency auto-installation, reverting to the v6 resolution algorithm where peers are not automatically hoisted, allowing the install to proceed with a warning rather than a hard error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:28:22.028646+00:00— report_created — created