Cargo build软件定制开发供应商失败解决办法
现象
cargo build 时下载失败(Mac 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.-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
# 放到 `$HOME/.cargo/config` 文件中[source.crates-io]registry = "https://github.com/rust-lang/crates.io-index"# 替换成你偏好的镜像源replace-with = 'sjtu'#replace-with = 'ustc'# 清华大学[source.tuna]registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"# 中国科学技术大学[source.ustc]registry = "git://mirrors.ustc.edu.cn/crates.io-index"# 上海交通大学[source.sjtu]registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"# rustcc社区[source.rustcc]registry = "git://crates.rustcc.cn/crates.io-index"[net]git-fetch-with-cli=true
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
变为上海交通大学的源,最重要的是 最后net的参数,设置为从git拉取。git不会被墙。