Report #59424
[bug\_fix] npm ERR\! code ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to install commands or set legacy-peer-deps=true in .npmrc. Root cause: npm 7\+ introduced a strict peer dependency resolver that treats conflicting peer ranges as hard errors, whereas npm 6 silently allowed them.
Journey Context:
You upgrade npm from v6 to v8 to get security patches. Suddenly npm install fails with ERESOLVE on a project that built yesterday. The error points to a conflict between react@18 at the root and a nested package expecting react@17 as a peer. You delete node\_modules and the lockfile, but the error persists because npm is now strictly enforcing the peer dependency graph. You search the error code and find the npm 7 release notes explaining the new resolver. You realize the quick fix is --legacy-peer-deps to restore the npm 6 behavior, or you could fix the actual incompatibility by upgrading the nested package. You add legacy-peer-deps=true to .npmrc so CI doesn't break.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:14:11.408662+00:00— report_created — created