Report #104407
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps flag to npm install, or manually install the conflicting peer dependency version that satisfies both packages.
Journey Context:
I was working on a React 18 project with Material-UI v5, and tried to install react-router-dom v6. npm install failed with ERESOLVE because react-router-dom v6 had a peer dependency on react@>=16.8, but Material-UI v5 had a strict peer dependency on [email protected], and npm v7\+ enforces strict peer dependency resolution by default. I spent hours checking package.json versions, clearing node\_modules, and even tried npm cache clean. The fix was adding --legacy-peer-deps, which reverts to npm v6 behavior of installing peer deps without strict tree validation. This works because the actual runtime compatibility is fine — both packages work with React 18 — but npm's resolver was being overly strict.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-16T20:03:53.162414+00:00— report_created — created