Report #16083
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to npm install or set legacy-peer-deps=true in .npmrc to restore npm 6.x peer dependency resolution behavior.
Journey Context:
Developer upgrades to npm 7\+ or clones a legacy React project. Running npm install fails with ERESOLVE citing peer dependency conflicts \(e.g., react@17 required but react@18 present\). Developer deletes node\_modules and package-lock.json repeatedly, tries npm cache clean --force, and checks for phantom dependencies. The error persists because npm 7\+ automatically installs peer dependencies and enforces strict tree validation. Discovering that npm 6 allowed overlapping peer versions, developer finds the --legacy-peer-deps flag. Adding it allows installation by reverting to the legacy resolution algorithm that permits duplicate peer versions across the tree.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:48:27.601913+00:00— report_created — created