有好一阵子没有更新源和安装软件了, 使用ustc的源, 更新了好一阵子, 最后安装居然还出现网络错误。。。。
warning: spurious network error (3 tries remaining) …
$ cargo install cargo-asm Updating `ustc` index warning: spurious network error (3 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2)) warning: spurious network error (2 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 3 was not closed cleanly: INTERNAL_ERROR (err 2)) warning: spurious network error (1 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 5 was not closed cleanly: INTERNAL_ERROR (err 2)) error: failed to download from `https://crates-io.proxy.ustclug.org/api/v1/crates/cargo-asm/0.1.16/download`
cargo 1.68 版本开始支持稀疏索引:不再需要完整克隆 crates.io-index 仓库,可以加快获取包的速度。如果您的 cargo 版本大于等于 1.68,可以在 $CARGO_HOME/config 中添加后面的内容:
注:sparse+ 表示在使用稀疏索引,链接末尾的 / 不能缺少。
注:$CARGO_HOME:在 Windows 系统默认为: %USERPROFILE%\.cargo,在类 Unix 系统默认为:$HOME/.cargo
建议 设置新的 sparse 的更新模式, 避免下载整个库, 切换也很灵活, 偶然发现字节的源速度还挺快, 故切换之;
修改 ~/.cargo/config 文件, 并设置如下的内容: 可以按需修改 replace-with 的那一行, 我目前换成了 字节 的源, 还挺快的;
我的汇总后的当前配置如下:
[source.crates-io] replace-with = 'ustc' [source.rsproxy-sparse] registry = "sparse+https://rsproxy.cn/index/" [source.rsproxy] registry = "https://rsproxy.cn/crates.io-index" [source.ustc] registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/" [source.tuna] registry = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/" [net] git-fetch-with-cli = true
上一篇:使用nvm管理node