Report #53693
[bug\_fix] npm ERR\! code ERESOLVE: ERESOLVE could not resolve
Add the --legacy-peer-deps flag to the npm install command, or downgrade to npm 6, or manually align conflicting peer dependency versions in package.json. Root cause: npm 7\+ automatically installs peer dependencies and strictly enforces version ranges, breaking legacy trees that relied on loose peer deps.
Journey Context:
Developer upgrades to Node 16/npm 7 and runs npm install on an existing React project. The install crashes with ERESOLVE showing a complex conflict tree involving react and react-dom. Developer deletes node\_modules and package-lock.json, clears npm cache, retries—same error. They search the error code and discover npm 7 changed peer dependency handling. Realizing the project was built with npm 6's looser resolution, they apply --legacy-peer-deps which restores npm 6 behavior, allowing the install to complete while preserving the original resolution algorithm.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:37:06.464854+00:00— report_created — created