Report #88770
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree - npm ERR\! Found: [email protected], npm ERR\! node\_modules/react, npm ERR\! peer react@'>=18.0.0' from the root project
Add the --legacy-peer-deps flag to npm install \(or set legacy-peer-deps=true in .npmrc\) to restore npm 6.x peer dependency behavior, then schedule a migration to upgrade the conflicting packages to versions with compatible peer ranges.
Journey Context:
Developer upgrades from Node 14 to Node 18 \(npm 6 to npm 8\) and runs npm install on an existing React 16 project. The install fails immediately with ERESOLVE. Developer deletes node\_modules and package-lock.json, tries again, same error. Reading the error, they see npm is trying to auto-install React 18 as a peer of a newer sub-dependency, which conflicts with the explicit React 16 in the root. Developer realizes npm 7\+ changed peer dependency handling. They add --legacy-peer-deps to the install command, which succeeds by allowing the peer conflict to exist as it did in npm 6. They later add legacy-peer-deps=true to .npmrc so CI works.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:35:17.343434+00:00— report_created — created