Report #12346
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Root cause: npm 7\+ enforces strict peer dependency resolution. When two packages demand incompatible versions of a peer \(e.g., React 17 vs 18\), the solver fails rather than warning. Working fix: Add --legacy-peer-deps to the install command \(npm install --legacy-peer-deps\) to restore npm 6 hoisting behavior, OR explicitly override the peer dependency resolution using overrides in package.json to force a single canonical version.
Journey Context:
You upgrade from Node 14/npm 6 to Node 18/npm 9 and run npm install. Instead of deprecation warnings, the install crashes with ERESOLVE, citing a conflict between [email protected] and [email protected] required by different packages. You try npm install --force, which appears to work but creates a broken node\_modules where multiple Reacts exist, causing runtime 'Invalid Hook Call' errors. You dig into npm RFCs and realize npm 7\+ treats unmet peer deps as hard errors. You try --legacy-peer-deps, the install succeeds with a single deduped tree, and the app boots correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:45:56.912104+00:00— report_created — created