将 Angular 编译器导入 Bit 会导致依赖树问题

问题描述

我正在尝试实施一个公共项目,其中保留了几个可重用的 Angular 组件和服务,我想将它们用于其他几个项目。我想使用 Bit 在我的项目之间共享组件(或者更确切地说是模块)。我按照 this 和其他教程中的说明进行操作。

以下命令都按预期工作正常:

npm install bit-bin -g

登录

位初始化

bit add --main src/components/content/editable/editable.image.module.ts

位状态提示如下:

new components
(use "bit tag --all [version]" to lock a version with all your changes)

    > image ... ok

当我想将 Angular 编译器导入 Bit 时,麻烦就开始了,如下所示:

bit import bit.envs/compilers/angular --compiler

Failed running npm install at /Users/SergDerbst/Development/tmt-patchbay/.git/bit/components/compilers/angular/bit.envs/10.1.7 with args: --production  
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: @bit/bit.envs.compilers.angular@10.1.7
npm ERR! Found: typescript@4.0.3
npm ERR! node_modules/typescript
npm ERR!   typescript@"4.0.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@">=3.0.0 <4.0" from @bazel/typescript@2.3.0
npm ERR! node_modules/@bazel/typescript
npm ERR!   @bazel/typescript@"2.3.0" 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! 
npm ERR! See /Users/SergDerbst/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/SergDerbst/.npm/_logs/2021-07-05T06_56_37_358Z-debug.log

我不太熟悉 npm 依赖处理,但显然编译器 @bit/bit.envs.compilers.angular@10.1.7 依赖 TypeScript 4.0.3,而 Bazel 需要一个旧版本的 TypeScript。奇怪的是,我自己的项目将 TypeScript 4.3.15 作为 devDependency:

"dependencies": {
    "@angular/common": "^12.1.1","@angular/core": "^12.1.1","rxjs": "^6.6.7"
},"devDependencies": {
    "@types/jest": "^26.0.23","jest": "^27.0.4","prettier": "^2.3.1","ts-jest": "^27.0.3","tslint": "^6.1.3","tslint-config-prettier": "^1.18.0","typescript": "^4.3.5"
},"bit": {
    "env": {},"componentsDefaultDirectory": "components/{name}","packageManager": "npm"
}

起初,我在我的项目中尝试了较旧的 TypeScript 版本或较旧版本的 Angular,但无济于事。我认为它与 Bit angular 编译器本身的依赖树有关。我可能可以将 Bazel 作为其依赖项排除在外,但这对于 Bit 原子化 Angular 模块来说应该是必要的。我试图用谷歌搜索这个问题,但找不到其他人遇到这个问题。

也许这是我有盲点的明显和愚蠢的事情。非常感谢任何帮助或提示

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)