Report #51200
[bug\_fix] npm ERR\! code ERESOLVE npm ERR\! ERESOLVE unable to resolve dependency tree
Run npm install with the --legacy-peer-deps flag to restore npm 6.x peer dependency behavior, or update conflicting peer dependencies to compatible version ranges.
Journey Context:
A developer upgrades to Node.js 16 \(which bundles npm 7\) and clones a legacy React project. Running npm install immediately fails with ERESOLVE, reporting that the project depends on React 16 while a sub-dependency requires React 17. The developer repeatedly deletes node\_modules and package-lock.json, but the error persists because npm 7\+ treats peer dependency conflicts as hard errors rather than warnings. After investigating the npm changelog and Arborist documentation, the developer realizes npm 7 introduced strict peer dependency resolution. Appending --legacy-peer-deps to the install command bypasses the strict resolution, allowing the install to complete while the team plans the React 17 migration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:25:44.608333+00:00— report_created — created