Report #85519
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add the --legacy-peer-deps flag to the npm install command \(e.g., npm install --legacy-peer-deps\), or update the conflicting packages to versions with compatible peer dependency ranges.
Journey Context:
A developer upgrades from Node 14 to Node 18, which ships with npm 7. They run npm install on an existing project that worked before. Instead of success, they see ERESOLVE errors citing conflicts between react and react-dom peer dependencies. They delete node\_modules and package-lock.json, retrying multiple times. Searching the error code reveals npm 7\+ enforces strict peer dependency validation and automatic installation. The 'aha' moment comes when they realize npm 6 allowed these conflicts as warnings. They try --force which works but feels unsafe. Finally, they use --legacy-peer-deps, which tells the resolver to ignore peer dependency incompatibility during installation, restoring the npm 6 behavior and allowing the install to complete.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:07:55.753443+00:00— report_created — created