現(xiàn)象
cargo build 時(shí)下載失?。∕ac 10.13.4),提示:
error: failed to download from https://crates-io.proxy.ustclug.org/api/v1/crates/actix-codec/0.3.0/download
Caused by:
[56] Failure when receiving data from the peer (Received HTTP code 500 from proxy after CONNECT)
或者提示:
error: failed to download from https://crates-io.proxy.ustclug.org/api/v1/crates/actix-codec/0.3.0/download
Caused by:
[60] Peer certificate cannot be authenticated with given CA certificates (SSL certificate problem: certificate has expired)
或者
Caused by:
failed to load source for dependency actix-cors
Caused by:
Unable to update registry crates-io
Caused by:
failed to update replaced source registry crates-io
Caused by:
failed to fetch https://mirrors.sjtug.sjtu.edu.cn/git/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:
[56] Failure when receiving data from the peer (Received HTTP code 500 from proxy after CONNECT); class=Net (12)
解決辦法
vi ~/.cargo/config文章來源:http://www.zghlxwxcb.cn/news/detail-403134.html
# 放到 `$HOME/.cargo/config` 文件中
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
# 替換成你偏好的鏡像源
replace-with = 'sjtu'
#replace-with = 'ustc'
# 清華大學(xué)
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
# 中國科學(xué)技術(shù)大學(xué)
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
# 上海交通大學(xué)
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
# rustcc社區(qū)
[source.rustcc]
registry = "git://crates.rustcc.cn/crates.io-index"
[net]
git-fetch-with-cli=true
變?yōu)樯虾=煌ù髮W(xué)的源,最重要的是 最后net的參數(shù),設(shè)置為從git拉取。git不會(huì)被墻。文章來源地址http://www.zghlxwxcb.cn/news/detail-403134.html
到了這里,關(guān)于【Rust】cargo update或者cargo build國內(nèi)被墻失敗解決辦法的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!