【Rust】 error: Unable to update registry `crates-io`

报错信息

    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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值