我尝试在本地更新angular cli版本,但是每次运行以下命令时,我都会收到以下错误:
npm卸载--save-dev angular-cli。(尝试按照here显示的步骤操作)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/build-angular@15.0.4
npm ERR! Found: @angular/compiler-cli@12.2.2
npm ERR! node_modules/@angular/compiler-cli
npm ERR! dev @angular/compiler-cli@"~12.2.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.0.4
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/compiler-cli@15.0.4
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.0.4
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.4" 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安装,我得到以下太:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/build-angular@15.0.4
npm ERR! Found: @angular/compiler-cli@12.2.2
npm ERR! node_modules/@angular/compiler-cli
npm ERR! dev @angular/compiler-cli@"~12.2.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.0.4
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/compiler-cli@15.0.4
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.0.4
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^15.0.4" 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!
无论我尝试什么,我都会得到同样的错误信息,而且我在网上没有找到任何有价值的东西。我怎么才能让这个工作呢?
2条答案
按热度按时间lvmkulzt1#
尝试以下命令
npm安装--强制
Angular /核心@15Angular /CL@15时ng更新-力
另外输入这个命令,这样就不必再次使用--force。
npm配置集传统对等部署为真
bxjv4tth2#
您有两个选项:
首先,通过安装满足@angular-devkit/build-angular对等依赖关系要求
然后再次运行命令
或者让NPM使用传统对等部门解决方案来解决它: