Report #57032
[bug\_fix] ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps flag to npm install, or set legacy-peer-deps=true in .npmrc
Journey Context:
Developer upgrades from npm 6 to npm 8 and runs npm install on an existing React project. The install immediately fails with "ERESOLVE unable to resolve dependency tree" and "Found: [email protected], could not resolve react@^18.0.0". Confused, the developer deletes node\_modules and package-lock.json and tries again, but hits the same error. They examine the full error log and see npm 7\+ now treats peer dependency conflicts as hard errors rather than warnings. They search for "ERESOLVE" and find Stack Overflow threads explaining that npm 7 introduced stricter peer dep resolution. They consider using --force but read it's unsafe. Instead, they add --legacy-peer-deps to their npm install command, which restores the npm 6 behavior of allowing peer dependency conflicts, allowing the install to complete successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:12:58.749905+00:00— report_created — created