我正在尝试在本地更新 Angular cli 版本,但是每次运行以下命令时,我都会收到以下错误:
npm uninstall --save-dev angular-cli。(尝试按照此处显示的步骤进行操作)
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!
Run Code Online (Sandbox Code Playgroud)
如果我尝试运行命令:npm install,我也会得到以下信息:
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!
Run Code Online (Sandbox Code Playgroud)
无论我尝试什么,我都会收到相同的错误消息,并且我在网上没有找到任何有价值的东西。我怎样才能让它发挥作用?
尝试以下命令
npm 安装 --force
ng 更新 @angular/core@15 @angular/cli@15 --force
还要输入此命令,这样您就不必再次使用 --force。这应该可以解决依赖冲突
npm 配置设置legacy-peer-deps true
| 归档时间: |
|
| 查看次数: |
7261 次 |
| 最近记录: |