Report #92835
[bug\_fix] npm ERR\! code ERESOLVE: could not resolve dependency tree due to peer conflict
This is caused by npm 7\+'s strict peer dependency resolution \(RFC 25\). The resolver fails if peer dependency ranges conflict in the tree. Use \`--legacy-peer-deps\` to restore npm 6's lenient behavior and allow installation to proceed, or use \`--force\` to override \(risky\). The permanent fix is to manually align peer dependencies by upgrading/downgrading packages to compatible ranges and regenerating package-lock.json.
Journey Context:
A developer upgrades from Node 14/npm 6 to Node 18/npm 8. Running \`npm install\` on a legacy React project immediately fails with ERESOLVE, displaying a complex tree showing \`[email protected]\` from the root conflicts with \`react@^16.8.0\` required by an old \`[email protected]\`. The developer deletes \`node\_modules\` and \`package-lock.json\` and retries, getting the identical error. Searching reveals npm 7\+ implements strict peer dependency resolution per RFC 25. The developer tries \`npm install --force\`, which installs but produces warnings about broken peer deps. Later, they discover \`--legacy-peer-deps\` which allows the install to proceed like npm 6, buying time to actually upgrade the routing library to a React 17-compatible version.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:24:49.237287+00:00— report_created — created