Report #79399
[bug\_fix] npm ERR\! code ERESOLVE npm ERR\! ERESOLVE unable to resolve dependency tree
Run npm install with --legacy-peer-deps to restore npm 6.x peer dependency behavior, or upgrade the conflicting package to a version compatible with your dependency tree.
Journey Context:
You just upgraded to Node 18 and npm 8, then cloned a legacy React project using react-scripts@4. You run npm install and immediately hit a wall of red text: 'ERESOLVE unable to resolve dependency tree' complaining that react-scripts requires react@^16 but you have react@18. You try deleting node\_modules and package-lock.json, but the error persists. You Google and find mentions of 'peer dependency resolution'. You try --force, which works but feels wrong. Deeper reading of npm RFC 0025 reveals npm 7\+ changed peer dependency handling to strict mode. You realize the package react-scripts@4 has a peer dep on react@^16 that conflicts with your react@18. Using --legacy-peer-deps restores the npm 6 behavior, allowing the install while warning about the mismatch, unblocking your build until you can properly upgrade react-scripts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:52:26.255661+00:00— report_created — created