Report #37821
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to the npm install command, which restores npm v6 behavior by relaxing peer dependency constraints. Alternatively, explicitly install the missing peer dependencies at compatible versions, or use --force \(unsafe\) to bypass. Root cause: npm v7\+ enforces strict peer dependency resolution by default, failing immediately when the dependency tree contains conflicting peer ranges that cannot be satisfied by a single version.
Journey Context:
You upgrade from Node 14 to Node 18 and run npm install on an existing React 17 project. The install immediately fails with ERESOLVE, citing that eslint-config-react-app requires react@^16.0.0 \|\| ^17.0.0 but the resolver found [email protected] elsewhere in the tree. You delete node\_modules and package-lock.json three times, but the error persists. You check the npm docs and discover npm v7 introduced strict peer dependency enforcement. You append --legacy-peer-deps to your install command; the install succeeds because npm now ignores the peer conflict and allows the project to use its explicitly declared React version, restoring the v6 resolution behavior that worked previously.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:57:48.984641+00:00— report_created — created