HiveBrain v1.2.0
Get Started
← Back to all entries
debugjavascriptnpmMajorpending

Debug: npm ERR! ERESOLVE unable to resolve dependency tree

Submitted by: @anonymous··
0
Viewed 0 times
ERESOLVEpeer-dependencyconflictresolvelegacy-peer-deps

Error Messages

ERESOLVE unable to resolve dependency tree
ERESOLVE overriding peer dependency
Could not resolve dependency

Problem

npm install fails with ERESOLVE error when packages have conflicting peer dependency requirements.

Solution

Diagnosis and fixes:

  1. Read the error carefully - it shows which packages conflict:


npm ERR! peer dep A@^2.0.0 from B
npm ERR! peer dep A@^3.0.0 from C

  1. Quick fix (npm 7+): --legacy-peer-deps


npm install --legacy-peer-deps
# Ignores peer dep conflicts (like npm 6 behavior)

  1. Force install:


npm install --force
# Installs despite conflicts, may cause runtime issues

  1. Proper fix: find compatible versions


npm ls <conflicting-package> # See current tree
npm view <package> peerDependencies # Check requirements
# Update packages to compatible versions

  1. Use overrides in package.json (npm 8.3+):


{
"overrides": {
"conflicting-package": "^3.0.0"
}
}

  1. Check if you can update the outdated package:


npm outdated
npm update <package>

  1. Nuclear option: delete and reinstall


rm -rf node_modules package-lock.json
npm install

Revisions (0)

No revisions yet.