Report #68803
[bug\_fix] ERESOLVE unable to resolve dependency tree
Add the --legacy-peer-deps flag to the npm install command to restore npm 6 behavior where peer dependency conflicts are ignored, or use --force to override the conflict \(risky\), or add an overrides section to package.json to force specific peer dependency versions.
Journey Context:
A developer upgrades to Node 16/18 which bundles npm 7\+. They attempt to install a legacy Create React App v4 project alongside React 18. npm calculates the dependency tree and detects a conflict: react-scripts@4 has a peer dependency on React ^16.0.0 \|\| ^17.0.0, but React 18 is present. npm 7\+ automatically installs peer dependencies by default, making this conflict unresolvable. The terminal shows 'ERESOLVE unable to resolve dependency tree' with a detailed conflict graph. The developer deletes node\_modules and package-lock.json repeatedly, but the error persists because it's a logic conflict, not a corrupted install. Searching reveals npm 7 changed peer dependency handling. Using --legacy-peer-deps tells npm to ignore peer dependency auto-installation and conflicts, allowing the install to proceed like it did in npm 6.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:58:19.202778+00:00— report_created — created