npm ERR! code ERESOLVE
TL;DRnpm failed to install packages because it could not resolve conflicting dependencies, usually peer dependency mismatches introduced in npm 7 and later.
Most likely cause: Peer dependency version conflicts between packages listed in package.json
Try first: Check current dependency tree for conflicts (npm ls)
Likely causes
- Peer dependency version conflicts between packages listed in package.jsonmost likely
- Outdated or incompatible packages in node_modules or package-lock.jsonpossible
- Strict dependency resolution rules in newer npm versionspossible
How to fix it
Safest first: SafeChanges settingsDangerous
Check current dependency tree for conflictsSafe
Run this read-only command in your project folder to list what is conflicting.
npm lsInstall with legacy peer dependency flagChanges settings
Add the flag that tells npm to use the older, less strict resolution behavior.
npm install --legacy-peer-depsClean install after removing lock fileDangerous
Delete node_modules and package-lock.json then reinstall. This can lose local changes so back up first.
rm -rf node_modules package-lock.json && npm install⚠ Back up your project folder before running this command.
If that didn't fix it
Run npm install with the --force flag and note any new error messages.
When to see a technician
If the project has many interdependent packages or you are not comfortable editing package.json, ask a Node.js developer for help.
Related errors
codenpm ERR! code ERESOLVE unable to resolve dependency treecodenpm ERR! code ENOENTcodenpm ERR! code ENOENT: no such file or directory, open 'package.json'codenpm ERR! code EACCES: permission denied, mkdir '/usr/local/lib/node_modules'codegyp ERR! find Python | gyp ERR! stack Error: Could not find any Python installation to usecodeERR_CONNECTION_RESET: Connection was reset