我运行了rustup update来更新我的工具链,并看到了两个警告:
warning: tool `rustfmt` is already installed, remove it from `/Users/<username>/.cargo/bin`, then run `rustup update` to have rustup manage this tool.
warning: tool `cargo-fmt` is already installed, remove it from `/Users/<username>/.cargo/bin`, then run `rustup update` to have rustup manage this tool.我遵循警告消息中的说明,然后再次尝试运行rustfmt。我得到了错误
error: toolchain 'stable-x86_64-apple-darwin' does not have the binary rustfmt`哪里出了问题,我怎么解决呢?
发布于 2017-12-22 17:33:51
在您的系统中拥有rustfmt的最标准和最可靠的方法是确保在Rustup工具链中安装了rustfmt组件。
rustup component add rustfmt或者对于特定的工具链:
rustup component add rustfmt --toolchain nightly-2020-06-09在夜间工具链中的测试和构建有可能失败,这意味着这些测试和构建不太可能总是具有此组件。最新的stable和beta工具链通常会按照无工具破损周策略使用。
为了让Rustup管理rustfmt,请参见以下步骤:
warning: tool rustfmt is already installed。按照建议,从货运的二进制文件夹中删除二进制文件。cargo uninstall rustfmt (如果安装了rustfmt-nightly )运行良好。rustup update,让它用自己的托管rustfmt和cargo-fmt填充已删除的二进制文件。stable)rustfmt组件。完成后,调用rustfmt将按预期工作:
$ rustup run stable rustfmt --version
rustfmt 1.4.12-stable (a828ffea 2020-03-11)或通过货物分命令:
$ cargo fmt --version
rustfmt 1.4.12-stable (a828ffea 2020-03-11)在早期,由Rustup管理的rustfmt可能会有些混乱,因为Rustup并不总是有rustfmt,而且仍然会经常出现预览组件,必须以rustfmt-preview的名称安装。在这个主题上有一些相关的问题和PRs (#1305和#1310)。
发布于 2018-05-15 13:59:59
该错误告诉您,您没有在实际的rustfmt-preview上安装*-apple-darwin。
你需要做的是:
rustup component add rustfmt-preview --toolchain stable-x86_64-apple-darwin
在你准备好之后:)
发布于 2018-10-29 03:34:07
$ rustup run stable rustfmt --version
error: `toolchain 'stable-x86_64-pc-windows-msvc' does not have th`e binary `rustfmt.exe`
$ rustup component remove rustfmt-preview --toolchain=stable-x86_64-pc-windows-msvc
info: removing component 'rustfmt-preview'
warning: during uninstall component rustfmt-preview-x86_64-pc-windows-msvc was not found
$ rustup component add rustfmt-preview --toolchain=stable-x86_64-pc-windows-msvc
info: downloading component 'rustfmt-preview'
info: installing component 'rustfmt-preview'
$ rustup run stable rustfmt --version
rustfmt 0.99.1-stable (da17b689 2018-08-04)https://users.rust-lang.org/t/problem-with-rustfmt-on-stable/15165/7
https://stackoverflow.com/questions/47945066
复制相似问题