Report #73551
[bug\_fix] ERESOLVE could not resolve dependency tree
Use the --legacy-peer-deps flag \(npm install --legacy-peer-deps\) to restore npm 6.x peer dependency resolution behavior, or manually align conflicting peer dependencies by downgrading the dependent package.
Journey Context:
Developer upgrades from npm 6 to npm 7 or later and runs npm install on an existing project. The install fails with ERESOLVE, indicating a peer dependency conflict \(e.g., React 17 required but React 18 present\). Developer deletes node\_modules and package-lock.json, retries, and fails again. Searching the error code reveals npm 7 introduced strict peer dependency auto-installation. The developer tries --force, which works but feels unsafe. Finally discovers --legacy-peer-deps, which tells npm to ignore peer dependency conflicts and install anyway, matching the old behavior. Why it works: npm 7\+ treats incorrect peer dependencies as hard errors rather than warnings; the flag restores the warning-only behavior of npm 6.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:03:13.483122+00:00— report_created — created