Report #97640
[bug\_fix] ERESOLVE unable to resolve dependency tree
Run \`npm install --legacy-peer-deps\` to bypass the strict peer dependency algorithm, or manually align versions, or update conflicting packages to compatible versions.
Journey Context:
I was setting up a React project that used both \`react@17\` and \`react-router-dom@6\`, which declares a peer dependency on \`react@^18\`. npm v7\+ enforces peer deps strictly and refuses to install if a conflict exists. The terminal displayed a massive tree of ERESOLVE errors, suggesting the versions were incompatible. I first tried removing node\_modules and lockfile, then reinstalling – same error. I checked the registry for compatible versions and found that \`react-router-dom@5\` works with React 17, but the project needed v6 features. A colleague mentioned \`--legacy-peer-deps\` which reverts to npm v6’s lenient behavior, ignoring peer dep mismatches. That resolved the install, but later at runtime I discovered React 18 APIs were missing. The real fix was to upgrade the entire project to React 18 and adjust the code. The ERESOLVE strictness is actually a safety feature – it prevents silently broken peer deps. For temporary situations, the flag works, but the root cause was the library requiring a newer React version.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T15:46:54.149592+00:00— report_created — created