如何在Windows 10上安装Rust时修复"检测到冲突"错误?

6

我正在尝试安装Rust,但遇到了以下错误:

info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: latest update on 2019-02-28, rust version 1.33.0 (2aa4c46cf 2019-02-28)
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
57.7 MiB /  57.7 MiB (100 %)   2.6 MiB/s ETA:   0 s
info: installing component 'rust-std'
51.4 MiB /  51.4 MiB (100 %)   4.9 MiB/s ETA:   0 s
info: installing component 'cargo'
  2.8 MiB /   2.8 MiB (100 %) 152.0 KiB/s ETA:   0 s
info: installing component 'rust-docs'
  8.5 MiB /   8.5 MiB (100 %) 281.6 KiB/s ETA:   0 s
info: rolling back changes
error: could not rename component file from 'C:\Users\rraut\.rustup\tmp\8va7fsfks8zkeb5b_dir\bk' to 'C:\Users\rraut\.rustup\toolchains\stable-x86_64-pc-windows-msvc\share/man'
error: could not rename component file from 'C:\Users\rraut\.rustup\tmp\mybj8dkhr27yqlzf_dir\bk' to 'C:\Users\rraut\.rustup\toolchains\stable-x86_64-pc-windows-msvc\share/man/man1'
error: could not rename component file from 'C:\Users\rraut\.rustup\tmp\5l3hc8i6tp_6rqsa_dir\bk' to 'C:\Users\rraut\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin'
error: could not rename component file from 'C:\Users\rraut\.rustup\tmp\ejk4eeibyz0dkgjt_dir\bk' to 'C:\Users\rraut\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/etc'
error: could not rename component file from 'C:\Users\rraut\.rustup\tmp\1758r_0hyzkhtohi_dir\bk' to 'C:\Users\rraut\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/x86_64-pc-windows-msvc/bin'
error: could not rename component file from 'C:\Users\rraut\.rustup\tmp\5_0tdsg3gat5u6yy_dir\bk' to 'C:\Users\rraut\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/x86_64-pc-windows-msvc/codegen-backends'
error: failed to install component: 'rust-docs-x86_64-pc-windows-msvc', detected conflict: '"share/doc/rust/html"'

有人在Windows 10上遇到过相同的问题吗?

你可以在 用户论坛 找到答案。我记得曾经看到过类似的问题。 - hellow
这里有一个类似的问题,提供了一些提示。不确定是否能解决你的问题,但值得尝试。 - zrzka
@zrzka 很抱歉,我没有访问那些设置的权限,需要联系基础架构团队来更改这些设置。 - Rahul Raut
1个回答

17

我遇到了相同的问题。我解决的方法是手动重新安装 stable-x86_64-pc-windows-msvc 工具链,这似乎是在安装过程中被损坏了。

我的做法如下:

rustup toolchain remove stable-x86_64-pc-windows-msvc

那么:

rustup install stable-x86_64-pc-windows-msvc

一些注意事项:

  • 您可以通过导航到您的用户文件夹并找到 .rustup 文件夹(例如:C:\ Users \ MyWindowsUser \ .rustup \ toolchains),获取工具链名称(它们按其发布通道分为 stable、nightly 和 beta)。
  • 这也应该修复 VSCode 的 RLS 扩展程序。

2
谢谢啊!对我有用。唯一的问题是我必须手动设置环境变量来运行 rustc。 - Rahul Raut

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接