我正在尝试在本地更新 Angular cli 版本,但是每次运行以下命令时,我都会收到以下错误:
npm uninstall --save-dev angular-cli。 (尝试按照所示步骤操作here https://www.angularjswiki.com/angular/update-angular-cli-version-ng-update-to-latest-6-7-versions/)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/[email protected] /cdn-cgi/l/email-protection
npm ERR! Found: @angular/[email protected] /cdn-cgi/l/email-protection
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/[email protected] /cdn-cgi/l/email-protection
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/[email protected] /cdn-cgi/l/email-protection
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/[email protected] /cdn-cgi/l/email-protection
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 install,我也会得到以下信息:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/[email protected] /cdn-cgi/l/email-protection
npm ERR! Found: @angular/[email protected] /cdn-cgi/l/email-protection
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/[email protected] /cdn-cgi/l/email-protection
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/[email protected] /cdn-cgi/l/email-protection
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/[email protected] /cdn-cgi/l/email-protection
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 安装 --force
ng 更新 @angular/core@15 @angular/cli@15 --force
还要输入此命令,这样您就不必再次使用 --force。这应该可以解决依赖冲突
npm 配置设置legacy-peer-deps true
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)