Report #103731
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Run \`npm install --legacy-peer-deps\` only when the conflict is caused by a dependency whose declared peer range is technically too narrow but is known to work with the newer version. For a real fix, align the installed package versions so that every peer dependency declaration is satisfied, or downgrade/upgade the conflicting package. \`--legacy-peer-deps\` reverts npm 7\+ to npm 6-style peer-dependency handling: it ignores peer conflicts instead of blocking the install, which is why it unblocks the tree.
Journey Context:
You upgrade a React app from 17 to 18 and run \`npm install react@18 react-dom@18\`. The install fails with ERESOLVE and points at \`@testing-library/react\` which peer-depends on \`react: ^17.0.0\`. At first you think React 18 is incompatible, but the library actually works with React 18; its maintainers just haven't widened the peer range yet. You try deleting \`node\_modules\` and \`package-lock.json\`, but npm 7\+ still rebuilds the full tree and rejects the conflict. You read the npm docs and see that ERESOLVE is the new strict peer-dependency resolver introduced in npm 7. The clean path is to use a version of \`@testing-library/react\` whose peer range includes React 18. If that version isn't released, \`--legacy-peer-deps\` is the documented escape hatch.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:36:38.430084+00:00— report_created — created