Report #45086
[bug\_fix] npm ERR\! code ERESOLVE - could not resolve dependency tree due to peer dependency conflicts
Use the --legacy-peer-deps flag to restore npm 6 behavior where peer dependencies are not automatically installed, or use --force to override the conflict. Alternatively, upgrade the conflicting packages to versions with compatible peer dependency ranges. Root cause: npm 7\+ automatically installs peer dependencies by default, creating version conflicts when different packages require incompatible versions of the same peer dependency.
Journey Context:
Developer upgrades from npm 6 to npm 7 \(or a teammate uses npm 7 while the lockfile was created with npm 6\) and runs npm install. Suddenly, the installation fails with ERESOLVE even though the project worked yesterday. They try deleting node\_modules and package-lock.json and reinstalling, but the error persists. They search the error code and find it's related to peer dependency resolution changes. They try npm install --force which works but feels risky. Eventually, they learn that --legacy-peer-deps is the canonical migration path for legacy projects, allowing them to defer peer dependency alignment until they can properly upgrade packages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:08:45.550740+00:00— report_created — created