Report #72176
[bug\_fix] ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps flag to npm install or set legacy-peer-deps=true in .npmrc. This restores npm 6 behavior where peer dependency conflicts are treated as warnings rather than fatal resolution blocks.
Journey Context:
Developer upgrades to Node.js 18 which bundles npm 7\+. Attempting to install a new React 18 project alongside an enterprise design system that peer-depends on React ^16.8.0. npm computes the ideal tree, detects the React version conflict \(16 vs 18\), and throws ERESOLVE with a long conflict report. Developer tries --force first, which bypasses peer dependency requirements entirely but causes runtime 'invalid hook call' errors because two React instances exist. After reading the npm 7 RFC, developer realizes ERESOLVE is enforcing strict peer resolution. Adding --legacy-peer-deps tells npm's arborist engine to use the legacy peer dependency resolution algorithm, allowing the install to proceed with a warning while the developer ensures React singleton via module resolution overrides in the bundler.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:43:52.982603+00:00— report_created — created