【发布时间】:2021-10-02 05:47:53
【问题描述】:
我有一个 Angular 应用程序,它使用本地共享组件(通过我们自己的 npm 服务器 - Verdaccio)
我更新了其中一个共享库,并使用npm link 将其共享到我的应用程序中进行测试,一切顺利。
然后我构建它并将其推送到我们的 npm 服务器。
现在,当我尝试npm install(npm 版本 7.21.1)时,我收到以下错误
$ npm i @my-comany/my-component-ui@7.0.5
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @my-comany/my-application@0.0.1
npm ERR! Found: @angular/core@12.0.5
npm ERR! 2 more (@angular/animations, @angular/cdk)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"12.2.4" from @angular/common@12.2.4
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"^12.0.5" from the root project
npm ERR! peer @angular/common@"^12.0.0 || ^13.0.0-0" from @angular/cdk@12.2.4
npm ERR! node_modules/@angular/cdk
npm ERR! @angular/cdk@"^12.0.5" from the root project
npm ERR! 1 more (@my-comany/my-suite-ui)
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 相关依赖项..
"dependencies": {
"@angular/animations": "^12.0.5",
"@angular/cdk": "^12.0.5",
"@angular/common": "^12.0.5",
"@angular/compiler": "^12.0.5",
"@angular/core": "^12.0.5",
"@angular/forms": "^12.0.5",
"@angular/material": "^12.0.5",
"@angular/material-moment-adapter": "^12.0.5",
"@angular/platform-browser": "^12.0.5",
"@angular/platform-browser-dynamic": "^12.0.5",
"@angular/router": "^12.0.5",
"devDependencies": {
"@angular-devkit/build-angular": "~12.0.5",
"@angular/cli": "^12.0.5",
"@angular/compiler-cli": "^12.0.5",
"@angular/language-service": "^12.0.5",
我尝试安装的共享库有
"peerDependencies": {
"@angular/animations": "~12.0.5",
"@angular/cdk": "^12.0.5",
"@angular/common": "~12.0.5",
"@angular/core": "~12.0.5",
"@angular/forms": "~12.0.5",
"@angular/material": "^12.0.5",
"@angular/material-moment-adapter": "^12.0.5",
"@angular/platform-browser": "~12.0.5",
"@angular/platform-browser-dynamic": "~12.0.5",
我查看了我所有的包文件,但在任何地方都没有提到@angular/core@"12.2.4" from @angular/common@12.2.4。
这可能来自哪里,或者我如何自己诊断?
【问题讨论】: