货物发布使用不同的依赖版本
当我进行货物库发布
时,它将无法编译该项目,因为出于某种原因,它使用了依赖关系的不同版本。但是,如果我做货物构建
它可以正常工作。
我看到,对于货物出版
它使用了其中一个依赖项的两个不同版本:
Compiling bitcoin v0.27.1
Compiling bitcoin v0.28.1
稍后失败,因为其中一个依赖项使用0.27.1,另一个使用0.28.1。
依赖项被指定为bitcoin =“ = 0.27.1”
在cargo.toml
中。如果我查看cargo.lock
文件,我只会看到版本0.27.1
。即cargo.lock
中只有一个条目,没有其他版本。 货物树
仅显示版本0.27.1
。 货物构建
仅使用0.27.1
进行编译。
目前尚不清楚0.28.1
来自货物发布
我如何告诉cargo Publish
不使用0.28。 1
并坚持cargo.lock
中的版本?我尝试了- 锁定
和- 冷冻
,但我没有任何效果。
更新 其中一个依赖项已定义bitcoin =“> = 0.27”
,并且似乎货物试图使用最新的版本0.28.1
仅仅是因为它只是因为它适合该遗留的标准。和0.27.1
为其他人。显然这是行不通的。如何强制使用一个版本?
更新2: 有冲突版本的整个树货物树 - all-features
:
├── bitcoin v0.27.1
.
├── emerald-hwkey v0.2.0
│ ├── bitcoin v0.27.1 (*)
│ ├── hdpath v0.6.1
│ │ ├── bitcoin v0.28.1
where hdpath:0.6.1
's crate.toml
接受任何版本通过:
bitcoin = { version = ">= 0.27", optional = true }
尚不清楚为什么货物试图升级此特定版本,并使一切都彼此不相容。
更新3: 如果我使用强制性“> = 0.27,< 0.28”
使用hdpath
的本地版本,那么它似乎有效。但是我不想要那个,因为hdpath
本身没有这种限制的理由,并且可以与任何版本一起使用。
因此,我只需要确保它使用与父项目兼容的版本。有什么办法吗?
When I do cargo publish
of my library it fails to compile the project because for a some reason it uses different version of a dependency. But if I do cargo build
it works fine.
I see that for cargo publish
it uses two different version of one of the dependencies:
Compiling bitcoin v0.27.1
Compiling bitcoin v0.28.1
And it fails later because one of the dependencies uses 0.27.1 and another 0.28.1.
The dependency is specified as bitcoin = "=0.27.1"
in Cargo.toml
. If I look into Cargo.lock
file I see only version 0.27.1
. I.e. only one entry, no other versions in Cargo.lock
. cargo tree
shows only version 0.27.1
as well. And cargo build
uses only 0.27.1
for compilation.
It's absolutely unclear where from the 0.28.1
comes from during the cargo publish
How I can tell cargo publish
to not use 0.28.1
and stick to version in the Cargo.lock
? I tried --locked
and --frozen
but I doesn't make any effect.
UPDATE
One of the dependencies has defined bitcoin = ">= 0.27"
and it seems that Cargo tries to use the most up-to-date version 0.28.1
only because it fits that criteria for that lib. And 0.27.1
for others. That obviously would not work. How to enforce it to use one version?
UPDATE 2:
There is the whole tree of the conflicting versions cargo tree --all-features
:
├── bitcoin v0.27.1
.
├── emerald-hwkey v0.2.0
│ ├── bitcoin v0.27.1 (*)
│ ├── hdpath v0.6.1
│ │ ├── bitcoin v0.28.1
Where hdpath:0.6.1
's Crate.toml
accepts any version via:
bitcoin = { version = ">= 0.27", optional = true }
So it's unclear why Cargo tries to upgrade this particular version and makes everything incompatible to each other.
UPDATE 3:
It seems that it works if I use a local version of hdpath
with enforced ">= 0.27, < 0.28"
. But I don't want that because hdpath
by itself doesn't have a reason for such restriction and works fine with any of the versions.
So I just need to make sure it uses the version compatible with the parent project. Is there any way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论