You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular部署时@ng-bootstrap依赖冲突问题排查求助

Angular依赖冲突根本原因排查

核心原因

  • 你当前项目使用的Angular版本为13.3.5,但安装的@ng-bootstrap/ng-bootstrap@10.0.0对@angular/common的peer依赖要求是^12.0.0(仅兼容Angular 12系列版本),两者版本不匹配。
  • 你使用的npm版本是8.16.0,npm 8.x及以上版本默认开启了严格的peer依赖校验规则,一旦检测到依赖包的peer依赖要求与项目现有依赖版本不兼容,就会直接抛出依赖解析失败的错误,终止安装流程。

验证方式

在项目根目录执行以下命令,可直接查看@ng-bootstrap/ng-bootstrap@10.0.0的peer依赖要求:

npm show @ng-bootstrap/ng-bootstrap@10.0.0 peerDependencies

执行后会返回如下结果,明确显示该版本仅支持Angular 12:

{
  "@angular/common": "^12.0.0",
  "@angular/core": "^12.0.0",
  "@angular/forms": "^12.0.0",
  "rxjs": "^6.6.0"
}

对比你的Angular环境信息,@angular/common版本为13.3.5,与ng-bootstrap要求的12.x版本范围完全不重叠,这就是触发npm依赖冲突报错的直接原因。

内容的提问来源于stack exchange,提问作者Rock

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 01:45:35