Report #60006
[bug\_fix] npm ERR\! code ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps flag to npm install or manually align peer dependency versions to satisfy the strict resolution algorithm.
Journey Context:
Developer upgrades from Node 14 to Node 18, bringing npm 8\+. Running npm install on an existing React 17 project throws ERESOLVE because transitive dependencies demand conflicting React versions \(16, 17, and 18\). The developer deletes node\_modules and package-lock.json, but the error persists. Googling reveals npm v7\+ introduced strict peer dependency resolution. The developer tries npm install --legacy-peer-deps, which restores the npm v6 behavior of ignoring peer conflicts, allowing the install to succeed. Alternatively, the developer could manually edit package.json to align all React-related peer dependencies to a single version, but the flag provides immediate relief while the team plans the upgrade.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T07:12:27.422446+00:00— report_created — created