Report #10232
[bug\_fix] npm ERR\! ERESOLVE could not resolve dependency tree - peer dependency conflict when installing packages with npm 7\+
Use the \`--legacy-peer-deps\` flag to restore npm 6's peer dependency behavior \(warning only\), or use \`--force\` to ignore conflicts, or resolve the actual version mismatch by upgrading the conflicting package to a version compatible with the root project's dependencies.
Journey Context:
You upgrade to Node.js 18 which bundles npm 9, then run \`npm install\` in a legacy React 17 project. Instead of warnings, npm errors with ERESOLVE stating that \`[email protected]\` from the root project conflicts with \`peer react@"^17.0.0"\` from some transitive dependency. You try deleting node\_modules and package-lock.json but the error persists because npm 7\+ strictly enforces peer dependencies as tree constraints. After digging into npm RFCs, you realize npm now auto-installs peer deps, causing version collisions that were previously ignored. Adding \`--legacy-peer-deps\` to the install command immediately resolves the tree by reverting to the npm 6 algorithm that treats peer deps as soft constraints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:11:20.690893+00:00— report_created — created