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

问题描述 投票:0回答:4

在 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: [email protected]
npm ERR! Found: @angular/[email protected]
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 [email protected]
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 中工作

如何解决这个问题?

angular ngx-bootstrap
4个回答
6
投票

运行这个:

npm install ngx-bootstrap@latest --legacy-peer-deps
。它对我有用,希望对未来的某人也有用


0
投票
  • 运行,它解决了我的问题:-
npm install ngx-bootstrap --save --force

0
投票

官网上说不兼容Angular 14版本。

look here


0
投票

运行此解决了问题:

npm i [email protected] --save
© www.soinside.com 2019 - 2024. All rights reserved.