当先锋百科网

首页 1 2 3 4 5 6 7

报错信息

    Updating crates.io index
error: Unable to update registry `crates-io`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)
root@DESKTOP-HNHSVEO:~/kvstore# root@DESKTOP-HNHSVEO:~/kvstore# cargo run --example clapgui
pdating crates.io index
error: -bash: root@DESKTOP-HNHSVEO:~/kvstore#: No such file or directory
Unabroot@DESKTOP-HNHSVEO:~/kvstore#     Updating crates.io index
le to update registry `crates-io`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  SSL error: received early EOF; class=Ssl (16); code=Eof (-20)Updating: command not found

查找资料后说要更新rustup,使用命令行 rustup update又报错:

rustup: command not found

运行rustup -version也报错:

rustup: command not found

解决方案

  1. 运行命令:
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. 添加路径到系统路径:
    运行命令:nano ~/.bashrc
    打开文件在末行添加export PATH="$HOME/.cargo/bin:$PATH"
    再运行source ~/.bashrc

验证

运行rustup --version
结果rustup 1.25.2 (17db695f1 2023-02-01)