npm ERR:code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency tree处理办法

今天在创建angular项目时,在npm install步骤时报错npm ERR

e:\angular\angulardemo>npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^14.2.0" from the root project
npm ERR!   peer @angular/common@"14.2.4" from @angular/[email protected]
npm ERR!   node_modules/@angular/forms
npm ERR!     @angular/forms@"^14.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"14.2.3" from @angular/[email protected]
npm ERR! node_modules/@angular/platform-browser
npm ERR!   @angular/platform-browser@"^14.2.0" from the root project
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.
npm ERR!
npm ERR! See C:\Users\Administrator\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2022-09-29T00_48_00_834Z-debug-0.log

 解决办法:在命令后面加上--legacy-peer-deps,如下图:

e:\angular\angulardemo>npm install --legacy-peer-deps

added 917 packages in 2m

大功告成!!!!!!!!!!!!!!!!!!!!!!!

希望有帮助到大家

猜你喜欢

转载自blog.csdn.net/qq_35262929/article/details/127100431