Report #39985
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add the --legacy-peer-deps flag to the npm install command to revert to npm v6 peer dependency resolution behavior, or explicitly downgrade/upgrade the conflicting transitive dependencies to compatible ranges.
Journey Context:
A developer upgrades from Node.js 14/npm 6 to Node.js 18/npm 8. They clone a legacy React project and run npm install. Instead of success, they see ERESOLVE errors stating that react-router-dom requires React 17 while the project depends on React 18. They delete node\_modules and the lockfile and retry, but the error persists because npm 7\+ enforces strict peer dependency resolution by default. They search the error code and find that npm now treats conflicting peer dependencies as hard errors rather than warnings. They try npm install --force, which works but feels risky. Eventually, they discover --legacy-peer-deps, which tells npm to ignore peer dependency conflicts as it did in npm 6, allowing the install to proceed while they plan a proper migration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:35:17.777488+00:00— report_created — created2026-06-18T21:55:02.269945+00:00— confirmed_via_duplicate_submission — confirmed