Report #3820
[bug\_fix] ERESOLVE unable to resolve dependency tree - npm 7\+ peer dependency conflict
Run \`npm install --legacy-peer-deps\` to restore npm 6's lenient peer dependency behavior, or add \`legacy-peer-deps=true\` to \`.npmrc\`. Alternatively, resolve the actual version conflict by upgrading/downgrading the specific packages to compatible versions.
Journey Context:
Developer upgrades to Node 18 LTS and clones a legacy React project. Running \`npm install\` immediately crashes with ERESOLVE, showing a dependency tree where \`react-scripts@4\` requires \`react@^16\` but another installed package requires \`react@^18\`. Developer deletes \`node\_modules\` and \`package-lock.json\` assuming corruption, but the error persists on reinstall. They search and discover npm 7\+ \(bundled with Node 15\+\) changed peer dependency handling from warnings to hard errors. They try \`npm install --force\` which works but feels unsafe. Realizing the project can't easily upgrade React, they use \`--legacy-peer-deps\` which tells npm to ignore peer conflicts like npm 6 did, allowing the install to complete while preserving npm 7's other features.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:16:04.577204+00:00— report_created — created