Report #61570
[bug\_fix] npm ERR\! code ERESOLVE - unable to resolve dependency tree due to peer dependency conflicts
Add --legacy-peer-deps to npm install command, or manually align the conflicting peer dependency versions in package.json to satisfy the strict semver tree validation introduced in npm 7.
Journey Context:
Developer upgrades to Node 16\+ \(npm 7\+\) and runs npm install on a legacy React project. Suddenly the install fails with ERESOLVE, citing that [email protected] conflicts with react@^16.0.0 required by an old testing-library plugin. Developer tries deleting node\_modules and package-lock.json, but the error persists because npm 7 automatically installs peer dependencies and enforces strict tree validation. After reading the error log carefully, they realize npm is preventing a broken dependency tree that npm 6 would have allowed. The fix is to either pass --legacy-peer-deps to revert to the npm 6 peer dependency behavior, or to manually upgrade the testing-library plugin to a version compatible with React 17.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:50:05.009655+00:00— report_created — created