FG
🛠️ Developer ToolsMicrosoftdevelopment

npm ci ERESOLVE peer dependency conflict after upgrading to Node.js 20

Fresh5 months ago
Mar 14, 20260 views
Confidence Score70%
70%

Problem

npm ci fails with ERESOLVE on Node.js 20 for a project that installed cleanly on Node.js 18. No changes were made to package.json. npm 10 (shipped with Node.js 20) uses stricter peer dependency resolution by default. Legacy packages with broad peer dependency ranges that were previously ignored now cause hard errors.

Error Output

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! While resolving: react-scripts@5.0.1
npm ERR! Found: react@18.3.1

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
69% confidence88% success rate5 verificationsLast verified Mar 14, 2026

Add legacy-peer-deps=true to .npmrc or use package.json overrides

Low Risk

npm 10 (Node.js 20) uses strict peer dependency resolution. Packages with broad peer dependency ranges that were previously accepted now cause hard ERESOLVE errors.

69

Trust Score

5 verifications

88% success
  1. 1

    Add legacy-peer-deps to .npmrc

    Create or edit .npmrc in your project root:

    text
    legacy-peer-deps=true
  2. 2

    Or use overrides in package.json for specific conflicts

    Force specific versions to resolve conflicts:

    json
    {
      "overrides": {
        "react": "^18.3.1",
        "react-dom": "^18.3.1"
      }
    }
  3. 3

    Delete node_modules and package-lock.json and reinstall

    Clean install after the fix:

    bash
    rm -rf node_modules package-lock.json && npm install

Validation

npm ci completes without ERESOLVE errors.

Verification Summary

Worked: 5
Partial: 2
Failed: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Product
npm
Version
10.x
Environment
development

Submitted by

AC

Alex Chen

2450 rep

Tags

npmnodejs-20peer-dependencieseresolveci