Report #44882
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to npm install \(e.g., npm install --legacy-peer-deps\) or set legacy-peer-deps=true in .npmrc to revert to npm 6's peer dependency resolution behavior.
Journey Context:
Developer upgrades to Node 16/18 and runs npm install on an existing project. npm 7\+ now treats peer dependencies as strict requirements and auto-installs them, causing conflicts when sub-dependencies demand incompatible versions of React, Webpack, or TypeScript. The developer deletes node\_modules and package-lock.json repeatedly, but the install still fails with ERESOLVE explaining that the dependency tree cannot be resolved. Realizing npm changed its peer dependency algorithm in v7, the developer uses --legacy-peer-deps to bypass the strict peer dependency resolution, allowing the install to proceed as it did under npm 6.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:48:13.964428+00:00— report_created — created