How to fix npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! peer dep missing in npm

npmINTERMEDIATEMEDIUMUpdated Dec 2, 2025ยท 172 views

npm cannot pick a compatible set of dependencies because peer requirements conflict. Align versions (or upgrade both sides) and reinstall.

Quick fix

Fixes npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! peer dep missing

npm install react@17 react-dom@17
# or upgrade plugin to support React 18
npm install some-plugin@latest
  1. Inspect the conflict tree
  2. Align versions to satisfy peers
  3. Clean and reinstall
  4. Use overrides only when you accept the risk
npm โ€” error
npm install react@17 react-dom@17
# or upgrade plugin to support React 18
npm install some-plugin@latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! peer dep missing

What this error means

npm v7+ enforces peer dependencies strictly. When two packages demand incompatible peer versions (e.g., plugin wants React 17 while you installed React 18), the resolver aborts with ERESOLVE and shows a conflict tree.

Typical symptoms

  • npm install fails with ERESOLVE and a dependency tree showing peer conflict
  • Plugins requiring older framework versions block install
  • Works only with --legacy-peer-deps or --force

Common causes

  1. Packages require incompatible peer versions (e.g., React 17 vs React 18)
  2. Lockfile pins versions outside declared peer ranges
  3. Mixing majors of a framework and its ecosystem plugins

How to fix "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! peer dep missing"

1Inspect the conflict tree

npm prints the conflicting packages. Read the requested vs installed versions to identify which pair is incompatible.

2Align versions to satisfy peers

Pick compatible versions (upgrade/downgrade both). Example for React:

bash
npm install react@17 react-dom@17
# or upgrade plugin to support React 18
npm install some-plugin@latest
3Clean and reinstall

After adjusting versions, reinstall to refresh the lockfile:

bash
rm -rf node_modules package-lock.json
npm install
4Use overrides only when you accept the risk

If you must force a version, add an override in package.json:

json
{
  "overrides": {
    "some-plugin/react": "18.0.0"
  }
}

Re-run npm install. Test carefully because forced peers may break runtime.

Advanced notes

Avoid --legacy-peer-deps as a long-term fix; it skips peer validation and can hide real incompatibilities. Prefer aligning the ecosystem on the same major version.

Frequently asked questions

What does "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency" mean?
npm v7+ enforces peer dependencies strictly. , plugin wants React 17 while you installed React 18), the resolver aborts with ERESOLVE and shows a conflict tree.
How do I fix "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency"?
npm cannot pick a compatible set of dependencies because peer requirements conflict. Align versions (or upgrade both sides) and reinstall.
What causes "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency"?
Packages require incompatible peer versions (e.g., React 17 vs React 18) Lockfile pins versions outside declared peer ranges Mixing majors of a framework and its ecosystem plugins
Is the "npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading