Report #97763
[bug\_fix] npm ERR\! code ERESOLVE npm ERR\! ERESOLVE unable to resolve dependency tree npm ERR\! Found: [email protected] npm ERR\! node\_modules/react npm ERR\! react@"^18" from the root project npm ERR\! Could not resolve dependency: npm ERR\! peer react@"^16.8.0 \|\| ^17.0.0" from @old/[email protected]
Run npm install --legacy-peer-deps as a one-time unblock, or \(preferred\) upgrade the libraries so their peerDependency ranges match your React version, or add an npm overrides field in package.json to force a compatible peer version. --legacy-peer-deps restores the npm 3-6 behavior of ignoring peerDependency conflicts during tree building, letting the install complete while still warning about mismatches.
Journey Context:
You joined a legacy dashboard repo on Node 20 with npm 10. npm install immediately dies with ERESOLVE pointing at react. You grep package.json and see react@18, but three transitive UI libraries peer-depend on react@^17. You try pinning react@17 and now your own code breaks because it uses React 18 hooks. You consider npm install --force, but that can install incompatible copies. Reading the npm config docs reveals that npm 7\+ switched to strict peer-dependency resolution; --legacy-peer-deps tells the resolver to skip peer-dependency conflict checks, which unblocks the install. The real fix is either upgrading the libraries or using npm overrides so the tree is internally consistent, but --legacy-peer-deps is the recognized escape hatch.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:39:54.334730+00:00— report_created — created