npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree
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.
Cause
ERESOLVE issues with npm@7 are common, because npm7.x is stricter about some things than npm6.x. Usually, the easiest fix is to pass the --legacy-peer-deps flag to npm (eg, npm i --legacy-peer-deps ), or use npm@6.
If this doesn't work right away, maybe remove node_modules and package-lock.json first. They will be recreated.
Solution
Downgrade npm to version 6
or
Use npx to specify the version of npm
npx -p npm@6 npm i --legacy-peer-deps
————————————————
Copyright statement: This article is the original article of CSDN blogger "Crazy Lion Li", following the CC 4.0 BY-SA copyright agreement, please attach the original source link for reprinting and this statement.
Original link: https://blog.csdn.net/weixin_40461281/article/details/115543024
- Enter this command in Terminal
npm install npm@3 -g
to install the latest version 3 (3 is the major version number) - Find the path of npm global installation, mine is: , copy the package
C:\Users\qwt19\AppData\Roaming\npm\node_modules
under this pathnpm
- Find the node_modules
node.js
under the installation path of , mine is: , just replace the npm package assigned in step 2 with the current directoryC:\tools\nodejs\node_modules
- Now enter
npm -v
to see the latest version of npm
Some other npm commands
1. Get the location of the npm command
npm config get prefix
// 我的npm在
“C:\Users\qwt19\AppData\Roaming\npm"
Author: JamesSawyer
Link: https://www.jianshu.com/p/a5ccd1aad62f
Source: Jianshu
The copyright belongs to the author. For commercial reprint, please contact the author for authorization, for non-commercial reprint, please indicate the source.