[英]Cargo Error: failed to get `X` as a dependency
我收到這個奇怪的錯誤:
cargo build
Updating crates.io index
error: failed to get `anyhow` as a dependency of package `FlexDB v0.1.0 (E:\projects\FlexDB)`
Caused by:
failed to load source for dependency `anyhow`
Caused by:
Unable to update registry `crates-io`
Caused by:
failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
missing delta bases; class=Indexer (15)
我的cargo.toml
文件如下所示:
[package]
name = "FlexDB"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1"
我不知道該怎么辦,我做了:
rustup update
@kornel 答案確實解決了這個錯誤,
“看起來您的 ~/.cargo/registry/index 目錄已損壞。刪除它並再次運行 cargo update。”
我在 docker 容器中運行貨物,所以當我收到以下錯誤時,我所做的是我刪除了以下目錄,以下目錄路徑可能因系統而異,貨物將打印路徑以及錯誤
rm -fr /usr/local/rust/registry
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.