如何解决Angular-14中的NGX-Bootstrap误差

发布于 2025-02-08 06:40:30 字数 2043 浏览 3 评论 0原文

在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中工作了

如何解决此问题?

In Angular-14 project, I have this 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"
},

So, as I decide to install ngx-bootstrap using ngx bootstrap:

npm install ngx-bootstrap --save

I got this error:

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!

It was working in Angular-13

How do I get this resolved?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

农村范ル 2025-02-15 06:40:30

运行以下操作:npm install ngx-bootstrap@最新 - legacy-peer-deps。它对我有用,希望将来对某人会

run this: npm install ngx-bootstrap@latest --legacy-peer-deps. It worked for me hope it will for someone in the future

顾北清歌寒 2025-02-15 06:40:30

在官方网站上,它说与Angular版本14没有兼容性。

在这里查看

On the official website it says that there is no compatibility with angular version 14.

look here

残疾 2025-02-15 06:40:30
  • 运行,这对我解决了问题: -
npm install ngx-bootstrap --save --force
  • Run, it's fixed the issue for me:-
npm install ngx-bootstrap --save --force
命硬 2025-02-15 06:40:30

运行此问题已解决:

npm i [email protected] --save

Running this fixed the issue:

npm i [email protected] --save
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文