使用cargo install 安装某包时报“error: failed to fetch `https://github.com/rust-lang/crates.io-index`”

在使用 cargo install 安装报如下错误的解决方式:

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


Caused by:

  unknown certificate check failure; class=Net (12); code=Certificate (-17)

安装nightly便可以解决。

C:\Users\rontom\rust-by-example>rustup install nightly

info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'

info: latest update on 2018-05-20, rust version 1.28.0-nightly (a3085756e 2018-0

5-19)

info: downloading component 'rustc'

 50.8 MiB /  50.8 MiB (100 %)   2.6 MiB/s ETA:   0 s

info: downloading component 'rust-std'

 45.5 MiB /  45.5 MiB (100 %)   2.6 MiB/s ETA:   0 s

info: downloading component 'cargo'

  2.6 MiB /   2.6 MiB (100 %)   2.5 MiB/s ETA:   0 s

info: downloading component 'rust-docs'

  8.7 MiB /   8.7 MiB (100 %)   2.7 MiB/s ETA:   0 s

info: installing component 'rustc'

info: installing component 'rust-std'

info: installing component 'cargo'

info: installing component 'rust-docs'


  nightly-x86_64-pc-windows-msvc installed - rustc 1.28.0-nightly (a3085756e 201

8-05-19)



C:\Users\rontom\rust-by-example>rustup default nightly

info: using existing install for 'nightly-x86_64-pc-windows-msvc'

info: default toolchain set to 'nightly-x86_64-pc-windows-msvc'


  nightly-x86_64-pc-windows-msvc unchanged - rustc 1.28.0-nightly (a3085756e 201

8-05-19)



-----------------------------------------

李彩不是为了生活而去生活的运营官