How to work around rustup-init failure

Posted 金庆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to work around rustup-init failure相关的知识,希望对你有一定的参考价值。

How to work around rustup-init failure

(Jin Qing’s Column, Mar., 2022)

rustup-init.exe may fail if some anti-virus software is running with realtime protection.

The error message is like this after many retries:

error: could not rename component file from 'C:\\.../rust/html' to 'C:\\.../rust/html'

See: https://github.com/rust-lang/rustup/issues/1912

And it is not possible to stop the anti-virus for a corporate laptop.

There is a way to workaround this. Here are the steps:

  1. Run rustup-init until it begins to retry renaming
  2. Kill rustup-init when it is retrying
    • rustup will be installed before the failure
    • do not let rustup-init do the cleanup after the final failure
  3. Run rustup update to install all.
  4. Run rustup-init again to setup others.

rustup update will report that rustc was not found:

C:\\Users\\jinqing01>rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
...
info: removing previous version of component 'rustc'
warning: during uninstall component rustc was not found
...
info: installing component 'rustc'
...  
info: checking for self-updates

  stable-x86_64-pc-windows-msvc updated - rustc 1.59.0 (9d1b2106e 2022-02-23) (from (rustc does not exist))

info: cleaning up downloads & tmp directories

Rerun rustup-init to setup the toolchain:

C:\\Users\\jinqing01>cargo --version
error: no override and no default toolchain set

C:\\Users\\jinqing01>d:
D:\\>cd tool
D:\\Tool>rustup-init.exe

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

...
Rust is installed now. Great!

Press the Enter key to continue.

D:\\Tool>cargo --version
cargo 1.59.0 (49d8809dc 2022-02-10)

以上是关于How to work around rustup-init failure的主要内容,如果未能解决你的问题,请参考以下文章

You could try using --skip-broken to work around the problem

How to make dictionary work in TexStudio

How to Make cURL works with cmake

how to transfer your linux to new work environment

How to set up a basic working Appium test environment

(转) How to Train a GAN? Tips and tricks to make GANs work