Report #25069
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Run npm install with the --legacy-peer-deps flag, or downgrade to npm v6. Root cause: npm v7\+ introduced a stricter peer dependency resolution algorithm that treats peer conflicts as hard errors rather than warnings, breaking legacy packages with loose or conflicting peer ranges.
Journey Context:
You upgrade to Node.js 16 or 18 which bundles npm v7\+. You run npm install on a legacy React project that worked fine yesterday. Instead of warnings, you get a hard ERESOLVE error stating 'could not resolve dependency tree' due to conflicting peer deps for React. You delete node\_modules and package-lock.json and retry, but the error persists because the algorithm itself changed. You search GitHub issues and find that npm v7 now strictly enforces peers. You try npm install --legacy-peer-deps which reverts to the v6 resolution behavior, and the install succeeds immediately.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:28:53.975811+00:00— report_created — created