Report #14718
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to npm install commands or set legacy-peer-deps=true in .npmrc. Root cause: npm 7\+ \(Node 15\+\) auto-installs peer dependencies by default \(RFC 25\), creating impossible version conflicts when transitive dependencies demand incompatible peer ranges.
Journey Context:
Developer upgrades to Node 18 and runs npm install on a legacy React 17 project. Immediately hits ERESOLVE citing [email protected] \(wanted by some transitive dependency\) conflicts with [email protected] \(root dependency\). Developer deletes node\_modules and package-lock.json repeatedly, tries npm install --force which installs but breaks runtime with multiple React copies. They dive into npm documentation and discover npm 7 changed peer dependency handling. They try --legacy-peer-deps flag which restores npm 6 behavior by ignoring automatic peer installation, allowing the old resolution algorithm to handle the tree. Build succeeds and React version stays at 17 as required.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:16:36.201428+00:00— report_created — created