ERESOLVE: next requires react ^18 (peer dependency conflict) Next.js Origin: On your device OSI layer 7 · Application Last updated 5 Nov 2026

npm: ERESOLVE unable to resolve dependency tree — Found: react@19.0.0 / Could not resolve dependency: peer react@"^18.2.0" from some-lib

A package requires a React version different from the one installed with Next.js.

Exact message you may see ERESOLVE unable to resolve dependency tree Found: react@19.0.0 peer react@"^18.2.0"npm ERR! Could not resolve dependency: peer react@"^18" fromConflicting peer dependency: react@18npm error ERESOLVE could not resolve next peer reactpeer react@"^18.2.0" from
Seen on: Next.js npm React

Meaning

Next.js 15 uses React 19; libraries pinned to React 18 may not declare support yet. Upgrade the library, install a compatible version, use --legacy-peer-deps or overrides as a temporary workaround (test thoroughly). Check the library's release notes for React 19 support.

Common causes

  • Library peerDependency limited to React 18
  • Next.js/React upgrade without checking dependencies
  • Mixed versions across workspaces
  • Lockfile from different versions
  • Beta/RC peer ranges

⚡ Quick fix

  1. Upgrade the conflicting package
  2. npm install --legacy-peer-deps (temporary)
  3. Use overrides in package.json after verifying compatibility

Detailed fix by platform

Linux

  1. npm ls react and npm explain react

How to diagnose

  1. Peer — Required range?
  2. Library — Newer version?
  3. Workaround — Overrides?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Conflicting app and page file was found — Next.js: ⨯ Conflicting app and page file was found, please remove the conflicting files to continue: "pages/index.tsx" - "app/page.tsx" (Next.js)Conflicting app and p…CORS error calling Next.js API route / route handler — Browser: Access to fetch at 'https://api.example.com/api/data' from origin 'https://app.example.com' has been blocked by CORS policy (Next.js route handler) (Next.js)CORS error calling Ne…ERESOLVE — npm ERR! code ERESOLVE — unable to resolve dependency tree (npm)ERESOLVEInvalid hook call — Error: Invalid hook call. Hooks can only be called inside of the body of a function component. (React)Invalid hook callInvalid hook call (duplicate React in Next.js) — Next.js: Error: Invalid hook call. Hooks can only be called inside of the body of a function component — Cannot read properties of null (reading 'useContext') (Next.js)Invalid hook call (du…next build: fetch failed ECONNREFUSED (build-time API) — Next.js: Error occurred prerendering page "/blog" TypeError: fetch failed { cause: Error: connect ECONNREFUSED 127.0.0.1:3000 } (Next.js)next build: fetch fai…next build: JavaScript heap out of memory — Next.js: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory (during next build) (Next.js)next build: JavaScrip…TS2604: JSX element type does not have any construct or call signatures — TypeScript: error TS2604: JSX element type 'Foo' does not have any construct or call signatures. (TypeScript)TS2604: JSX element t…ERESOLVE:…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.