【问题标题】:Cargo Error: failed to get `X` as a dependency货物错误:未能将“X”作为依赖项
【发布时间】:2021-10-08 15:33:04
【问题描述】:

我收到了这个奇怪的错误:

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"

我不知道该怎么办,我做到了:

  1. rustup update
  2. 重启电脑

【问题讨论】:

  • 听起来您遇到了互联网问题?你可以试试 cargo clean 和 cargo build。

标签: rust rust-cargo


【解决方案1】:

@kornel 的回答确实解决了这个错误,

“您的 ~/.cargo/registry/index 目录似乎已损坏。删除它并再次运行 cargo update。”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-10
    • 1970-01-01
    • 2012-03-10
    • 2020-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多