patch版本不匹配引发peerDependency冲突,求解决方案
npm peerDependency版本冲突疑惑
我遇到了npm peerDependency版本冲突问题,项目my-api依赖自研私有库package A,而package A将另一个私有库package B列为peerDependency。只有安装package A的peerDependencies中指定的package B精确版本时才能正常运行,这很奇怪——package A的依赖配置如下:
{ "name": "package-a", "peerDependencies": {"package-b": "^0.0.8"} }
我在项目中安装的是"package-b": "^0.0.9",按道理^0.0.9应该能满足^0.0.8的版本要求?
以下是错误信息:
While resolving: my-api npm ERR! Found: @a/package-b@0.0.9 npm ERR! node_modules/@a/package-b npm ERR! @a/package-b@"^0.0.9" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @a/package-b@"^0.0.8" from @a/package-a@4.0.0 npm ERR! node_modules/@a/package-a npm ERR! @a/package-a@"^4.0.0" from the root project
npm的错误信息让我十分困惑!我本以为0.x.x版本能兼容^0.0.8,原配置应该也能生效。
编辑补充:我尝试将package A的依赖改为"package-b": "0.x.x",但仍出现相同错误。
内容的提问来源于stack exchange,提问作者Marco Moura
相关产品推荐
相关产品推荐

