0

我有一个普通的 Angular 项目和一个 Angular 库。
两者都曾经是 Angular 12,但今天我决定升级到 Angular 13。

我使用 Angular cli 的命令完成了这项工作,起初一切似乎都很好。
但是在尝试在我的 Angular 项目中安装该库后,我收到一条错误消息:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-main-project@1.0.0
npm ERR! Found: @angular/common@13.1.1
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~13.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^12.2.0" from my-library-project@0.0.12
npm ERR! node_modules/my-library-project
npm ERR!   my-library-project@"*" 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.

这个错误信息对我来说很奇怪,因为我都成功升级到了 Angular 13。包“my-library-project”没有对@angular/common@“^12.2.0”的任何引用。所有依赖项、对等依赖项、package.json 等都只有 Angular 13.1。

即使我在整个项目中搜索 "@angular/common@"^12.2.0" 我也找不到。
过了一会儿我尝试了以下事情:

  • 删除所有项目中的 node_modules 文件夹并再次 npm install
  • 清除 NPM 缓存
  • 删除 package-lock.json

但我仍然得到这个奇怪的错误。我不知道我还能在哪里搜索旧的 @angular/common 包。

有任何想法吗?

4

0 回答 0