Report #5382
[bug\_fix] npm ERR\! code ERESOLVE npm ERR\! ERESOLVE unable to resolve dependency tree
Append --legacy-peer-deps to npm install, or set legacy-peer-deps=true in .npmrc. This restores npm 6 behavior where peer dependency conflicts are warnings, not fatal errors. Root cause: npm 7\+ automatically installs peer dependencies and enforces strict semver conflicts.
Journey Context:
A developer upgrades from Node 14 to Node 18, which ships npm 8. Cloning a legacy React 16 project and running npm install throws ERESOLVE because React 16 has a peer dependency on react-dom@^16.0.0, but another package depends on [email protected]. The developer deletes node\_modules and package-lock.json repeatedly, thinking the lockfile is corrupted. They search the error code and discover that npm 7\+ changed peer dependency handling from warnings to hard errors. The --legacy-peer-deps flag bypasses the new strict peer dependency resolution algorithm, restoring npm 6 behavior and allowing the install to proceed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:10:58.506699+00:00— report_created — created