1. Error reporting scenario
Maintain a project, get the project code, install dependencies, and get an error when executing npm install!
2. Error code
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/javascript-obfuscator
npm ERR! dev javascript-obfuscator@"4.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer javascript-obfuscator@"^2.6.0" from [email protected]
npm ERR! node_modules/webpack-obfuscator
npm ERR! dev webpack-obfuscator@"2.6.0" from the root project
3. Error picture
4. Error translation
Unable to parse dependency tree! ! !
5. Solution
6. Execute solution command
npm install --force
或者
npm install --legacy-peer-deps
This method did not solve my problem, find out the cause!
7. Analyze the cause of the error report
In fact, problems related to npm@7 and ERESOLVE are relatively common. This is because npm7.x is more strict than npm6.x for certain things. The usual solution is to use npm install --legacy-peer-deps or use npm@ 6.
8. npm version
9. Use npx to specify npm version installation
npx -p npm@6 npm install --legacy-peer-deps