繁体   English   中英

如何解决 Angular-14 中的 ngx-bootstrap 错误

[英]How to resolve ngx-bootstrap error in Angular-14

在 Angular-14 项目中,我有这个package.json

package.json:

"dependencies": {
  "@angular/animations": "^14.0.0",
  "@angular/common": "^14.0.0",
  "@angular/compiler": "^14.0.0",
  "@angular/core": "^14.0.0",
  "@angular/forms": "^14.0.0",
  "@angular/platform-browser": "^14.0.0",
  "@angular/platform-browser-dynamic": "^14.0.0",
  "@angular/router": "^14.0.0",
  "@rxweb/reactive-form-validators": "^2.1.7",
  "admin-lte": "3.2",
  "google-libphonenumber": "^3.2.28",
  "intl-tel-input": "^17.0.3",
  "ngx-toastr": "^14.3.0",
  "npm-check": "^5.9.2",
  "rxjs": "~7.5.0",
  "sweetalert2": "^11.4.17",
  "tslib": "^2.3.0",
  "zone.js": "~0.11.4"
},

因此,当我决定使用ngx bootstrap安装ngx-bootstrap时:

npm 安装 ngx-bootstrap --save

我收到了这个错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ddm-ui@0.0.0
npm ERR! Found: @angular/animations@14.0.1
npm ERR! node_modules/@angular/animations
npm ERR!   @angular/animations@"^14.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/animations@"^13.0.0" from ngx-bootstrap@8.0.0
npm ERR! node_modules/ngx-bootstrap
npm ERR!   ngx-bootstrap@"*" 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!

它在 Angular-13 中工作

我该如何解决这个问题?

  • 运行,它为我解决了这个问题:-
npm install ngx-bootstrap --save --force

在官方网站上它说与 Angular 版本 14 不兼容

看这里

运行这个: npm install ngx-bootstrap@latest --legacy-peer-deps 它对我有用,希望将来对某人有用

基于,正如它所说,您存在依赖冲突(不正确且可能损坏的依赖),因此请尝试使用--force--legacy-peer-deps运行命令

所以运行这个:

npm install ngx-bootstrap@latest --legacy-peer-deps

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM