Build failed: npm ERR! ERESOLVE
Vercel stops on npm ERR! ERESOLVE unable to resolve dependency tree? npm is refusing a peer dependency clash. Fix the versions, or override the install command on purpose.
Reviewed October 14, 2026
What it means in plain English
The site never gets built. npm looked at package.json and could not pick versions that satisfy every package's peer dependencies. npm 7 and later treat that clash as a failed install. Vercel runs that install during the build, so the deploy stops with npm ERR! code ERESOLVE.
Likely causes
- Two packages ask for different versions of the same peer. The log names them under
While resolvingandCould not resolve dependency. - The lockfile was created with a looser npm, and Vercel installs with a current npm that enforces peers.
- Someone added
--legacy-peer-depslocally and did not tell Vercel to do the same.
How to fix it, step by step
- Open the failed Vercel deployment and read the
ERESOLVEblock. Note the package thatFounda version and the package thatCould not resolveits peer. - Prefer a real version fix: upgrade or remove the package that demands the old peer, or pin the peer to a version both sides allow. Commit the updated
package.jsonand lockfile. - If you must ship before that package is fixed, npm documents
--legacy-peer-deps. It makes npm ignorepeerDependenciesthe way npm 3 through 6 did. npm's own docs say this is not recommended, because it skips the peer contract. - To use that flag on Vercel, set
installCommandinvercel.jsonat the repo root, or override Install Command in Project → Settings → Build and Deployment. Example:npm install --legacy-peer-deps. An emptyinstallCommandskips install entirely, which is not what you want here. - Redeploy. A local
node_modulesfolder is not uploaded, so the host has to install again.
How to check it worked
- The deployment log gets past "Installing dependencies" and finishes the build.
- The production URL loads the new deployment.
Sources
Related fixes
Can't fix it? Get help.
If the steps didn't clear the error, send what the screen says. A person can take a look. This is a request for a paid fix, not an instant chat.