Report #82045
[bug\_fix] npm ERR\! code ERESOLVE
Add --legacy-peer-deps to npm install command, or set legacy-peer-deps=true in .npmrc. Root cause: npm 7\+ automatically installs peer dependencies; when two packages in the tree request incompatible versions of the same peer \(e.g., React 17 vs 18\), the resolver cannot find a single version to satisfy both, whereas npm 6 ignored this conflict.
Journey Context:
Developer upgrades from Node.js 14 to 18, which bumps npm from 6 to 8. They run npm install on an existing React project. Suddenly, the install crashes with ERESOLVE and a dependency tree showing conflicting React versions required by different packages. They try deleting node\_modules and package-lock.json, but the error persists because the conflict is in the logical tree, not the files. They search online and find suggestions to use --force, which works but feels dangerous. Eventually, they discover --legacy-peer-deps restores the npm 6 behavior of ignoring peer conflicts, giving them time to upgrade the conflicting packages properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:18:21.925491+00:00— report_created — created