bezzoon
bezzoon

Reputation: 2019

npm i resulting in many ERESOLVE issues

I am getting this error on npm i

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: [email protected]
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"4.41.5" from the root project
npm ERR!   peer webpack@">=2" from [email protected]
npm ERR!   node_modules/babel-loader
npm ERR!     dev babel-loader@"^8.0.0" from the root project
npm ERR!   2 more (copy-webpack-plugin, css-loader)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev mini-css-extract-plugin@"^0.9.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.4.0" from [email protected]
npm ERR!   node_modules/mini-css-extract-plugin
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

I get it when I downgrade nodejs to 14.15.4, but I may actually need to downgrade node.js.

Any idea how to interpret this issue and resolve it?

Upvotes: 9

Views: 12528

Answers (2)

Yasar Whizz
Yasar Whizz

Reputation: 17

For npm v7+. It is due to missing dependencies for entries mentioned in package.json file

use npm i --force, or npm i --legacy-peer-deps to override peer dependency.

Upvotes: -1

Trott
Trott

Reputation: 70153

ERESOLVE issues with npm@7 are common because npm 7.x is more strict about certain things than npm 6.x. Often, the easiest resolution is to pass the --legacy-peer-deps flag to npm (e.g., npm i --legacy-peer-deps) or else use npm@6.

If that doesn't work immediately, perhaps try removing node_modules and package-lock.json first. They will be recreated.

(Tip: You don't need to uninstall npm@7 to use npm@6. Use npx to specify the version of npm instead. For example: npx -p npm@6 npm i --legacy-peer-deps.)

Upvotes: 24

Related Questions