Report #26638
[bug\_fix] npm ERR\! code ERESOLVE
Run npm install with --legacy-peer-deps to restore npm 6.x peer dependency resolution behavior, or use --force to bypass peer conflict checks entirely.
Journey Context:
Developer upgrades to Node.js 16\+ which bundles npm 7\+. Running npm install suddenly fails with ERESOLVE, citing that the dependency tree contains conflicting peer dependencies \(e.g., react@17 vs react@18\). Developer deletes node\_modules and package-lock.json, but the error persists because npm 7\+ automatically installs peer dependencies and enforces strict version matching by default. After searching the error code, the developer realizes the project has legitimate peer conflicts that npm 6 ignored. Adding --legacy-peer-deps disables automatic peer dependency installation and strict checking, allowing the install to proceed with warnings instead of hard errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:06:48.484759+00:00— report_created — created