npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving:

huangapple go评论82阅读模式
英文:

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving:

问题

尝试使用 --force--legacy-peer-deps 选项重新运行命令,或者解决上游依赖冲突。

英文:

im using Angualr 15 , and i try to install an npm for extract the HTML to PDF , i try many package and every time it display to me this message :

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular/compiler-cli@15.2.4
npm ERR! Found: @angular/compiler@15.1.5
npm ERR! node_modules/@angular/compiler
npm ERR!   peer @angular/compiler@"15.1.5" from @angular/platform-browser-dynamic@15.1.5
npm ERR!   node_modules/@angular/platform-browser-dynamic
npm ERR!     @angular/platform-browser-dynamic@"^15.1.0" from the root project
npm ERR!   @angular/compiler@"^15.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"15.2.4" from @angular/compiler-cli@15.2.4
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.1.6
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^15.1.2" from the root project
npm ERR!   peer @angular/compiler-cli@"15.2.4" from @angular/localize@15.2.4
npm ERR!   node_modules/@angular/localize
npm ERR!     peerOptional @angular/localize@"^15.0.0" from @angular-devkit/build-angular@15.1.6
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"^15.1.2" from the root project
npm ERR!     1 more (@ng-bootstrap/ng-bootstrap)
npm ERR!   2 more (@ngtools/webpack, the root project)
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/compiler@15.2.4
npm ERR! node_modules/@angular/compiler
npm ERR!   peer @angular/compiler@"15.2.4" from @angular/compiler-cli@15.2.4
npm ERR!   node_modules/@angular/compiler-cli
npm ERR!     peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.1.6
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"^15.1.2" from the root project
npm ERR!     peer @angular/compiler-cli@"15.2.4" from @angular/localize@15.2.4
npm ERR!     node_modules/@angular/localize
npm ERR!       peerOptional @angular/localize@"^15.0.0" from @angular-devkit/build-angular@15.1.6
npm ERR!       node_modules/@angular-devkit/build-angular
npm ERR!         dev @angular-devkit/build-angular@"^15.1.2" from the root project
npm ERR!       1 more (@ng-bootstrap/ng-bootstrap)
npm ERR!     2 more (@ngtools/webpack, 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!

How can i solve it , and thanks

答案1

得分: 1

  • 强制安装 npm i --force
  • 安装所有依赖项 npm i --legacy-peer-dep

或者,

  • 删除 package.lock.json
  • 删除您的 node_modules 文件夹
英文:

As it should suggests, you can either:

  • force the installation npm i --force
  • Install all the dependencies npm i --legacy-peer-dep

Otherwise, you can

  • Delete package.lock.json
  • Remove your node_modules folder

huangapple
  • 本文由 发表于 2023年5月10日 23:55:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76220476.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定