Report #17772
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Run npm install with --legacy-peer-deps flag, or use --force. Root cause: npm 7\+ automatically installs peer dependencies and enforces strict peer dependency version matching, breaking projects with conflicting transitive peer ranges that worked under npm 6's looser resolution.
Journey Context:
Developer clones a legacy React project from 2020, runs npm install with npm 8. Immediately hits ERESOLVE error stating 'could not resolve [email protected] vs [email protected] peer dep'. Developer deletes node\_modules and package-lock, retries, same error. Scrolling reveals npm 7\+ stricter peer resolution. Initially tries --force which works but feels wrong. Eventually discovers --legacy-peer-deps restores npm 6 behavior, allowing the install to complete by not auto-installing conflicting peers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:20:34.123249+00:00— report_created — created