Following the instructions in https://beta.rust-lang.org/learn/get-started I ran the commands:
rustup add component rustfmt and rustup add component clippy and got the following errors:
error: toolchain 'stable-x86_64-apple-darwin' does not contain component 'rustfmt' for target 'x86_64-apple-darwin'
and
error: toolchain 'stable-x86_64-apple-darwin' does not contain component 'clippy' for target 'x86_64-apple-darwin'
I am new to the community, so apologies if this has an obvious explanation.
Could you try running rustup self update and then try again please? You'll also need to try on eitherr beta or nightly toolchains, not stable.
No luck with rustup self update. By the way the same problem arose on a Ubuntu 18.04.1 LTS box:
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rustfmt' for target 'x86_64-unknown-linux-gnu'
As for the beta and nightly toolchains, is the documentation at https://beta.rust-lang.org/ supposed to work only with those? I think the website should explicitly mention it, because the wording suggests that the only _beta_ is the website, not the tooling.
I don't know if it's related, but on Windows running rustup self update will say it's downloading, then say that it's successfully updated to 1.14.0, which is the version I get with rustup -V. Running rustup self update again repeats the cycle.
On GNU/Linux, rustup self update did update to 1.15.0. (I did this a few days ago, so I don't know if something has changed since.)
There were distribution problems with rustup on Windows, they're currently being addressed, so hopefully this should be resolved today.
I'm seeing the same issue on macOS 10.12.
error: toolchain 'stable-x86_64-apple-darwin' does not contain component 'rustfmt' for target 'x86_64-apple-darwin'
I did `rustup self update` and here is the output of `-V`
rustup 1.16.0 (beab5ac2b 2018-12-06)
And here is the output of `rustfmt component list`
cargo-x86_64-apple-darwin (default) clippy-preview-x86_64-apple-darwin (installed) lldb-preview-x86_64-apple-darwin llvm-tools-preview-x86_64-apple-darwin rls-preview-x86_64-apple-darwin rust-analysis-x86_64-apple-darwin rust-docs-x86_64-apple-darwin (default) rust-src rust-std-aarch64-apple-ios rust-std-aarch64-fuchsia rust-std-aarch64-linux-android rust-std-aarch64-unknown-cloudabi rust-std-aarch64-unknown-linux-gnu rust-std-aarch64-unknown-linux-musl rust-std-arm-linux-androideabi rust-std-arm-unknown-linux-gnueabi rust-std-arm-unknown-linux-gnueabihf rust-std-arm-unknown-linux-musleabi rust-std-arm-unknown-linux-musleabihf rust-std-armebv7r-none-eabi rust-std-armebv7r-none-eabihf rust-std-armv5te-unknown-linux-gnueabi rust-std-armv5te-unknown-linux-musleabi rust-std-armv7-apple-ios rust-std-armv7-linux-androideabi rust-std-armv7-unknown-cloudabi-eabihf rust-std-armv7-unknown-linux-gnueabihf rust-std-armv7-unknown-linux-musleabihf rust-std-armv7r-none-eabi rust-std-armv7r-none-eabihf rust-std-armv7s-apple-ios rust-std-asmjs-unknown-emscripten rust-std-i386-apple-ios rust-std-i586-pc-windows-msvc rust-std-i586-unknown-linux-gnu rust-std-i586-unknown-linux-musl rust-std-i686-apple-darwin rust-std-i686-linux-android rust-std-i686-pc-windows-gnu rust-std-i686-pc-windows-msvc rust-std-i686-unknown-cloudabi rust-std-i686-unknown-freebsd rust-std-i686-unknown-linux-gnu rust-std-i686-unknown-linux-musl rust-std-mips-unknown-linux-gnu rust-std-mips-unknown-linux-musl rust-std-mips64-unknown-linux-gnuabi64 rust-std-mips64el-unknown-linux-gnuabi64 rust-std-mipsel-unknown-linux-gnu rust-std-mipsel-unknown-linux-musl rust-std-powerpc-unknown-linux-gnu rust-std-powerpc-unknown-linux-gnuspe rust-std-powerpc64-unknown-linux-gnu rust-std-powerpc64le-unknown-linux-gnu rust-std-powerpc64le-unknown-linux-musl rust-std-riscv32imac-unknown-none-elf rust-std-riscv32imc-unknown-none-elf rust-std-s390x-unknown-linux-gnu rust-std-sparc-unknown-linux-gnu rust-std-sparc64-unknown-linux-gnu rust-std-sparcv9-sun-solaris rust-std-thumbv6m-none-eabi rust-std-thumbv7em-none-eabi rust-std-thumbv7em-none-eabihf rust-std-thumbv7m-none-eabi rust-std-wasm32-unknown-emscripten rust-std-wasm32-unknown-unknown rust-std-x86_64-apple-darwin (default) rust-std-x86_64-apple-ios rust-std-x86_64-fuchsia rust-std-x86_64-linux-android rust-std-x86_64-pc-windows-gnu rust-std-x86_64-pc-windows-msvc rust-std-x86_64-rumprun-netbsd rust-std-x86_64-sun-solaris rust-std-x86_64-unknown-cloudabi rust-std-x86_64-unknown-freebsd rust-std-x86_64-unknown-hermit rust-std-x86_64-unknown-linux-gnu rust-std-x86_64-unknown-linux-gnux32 rust-std-x86_64-unknown-linux-musl rust-std-x86_64-unknown-netbsd rust-std-x86_64-unknown-redox rustc-x86_64-apple-darwin (default) rustfmt-preview-x86_64-apple-darwin
This is also preventing the removal of clippy-preview
rustup component remove clippy-preview-x86_64-apple-darwin
error: toolchain 'stable-x86_64-apple-darwin' does not contain component 'clippy-preview-x86_64-apple-darwin' for target 'x86_64-apple-darwin'
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: checking for self-updates
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04)
$ rustup -V
rustup 1.16.0 (beab5ac2b 2018-12-06)
$ rustup self update
info: checking for self-updates
$ rustup -V
rustup 1.16.0 (beab5ac2b 2018-12-06)
$ rustup default stable
info: using existing install for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04)
$ rustup component add rustfmt
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rustfmt' for target 'x86_64-unknown-linux-gnu'
But:
$ rustup default 1.31.0
info: using existing install for '1.31.0-x86_64-unknown-linux-gnu'
info: default toolchain set to '1.31.0-x86_64-unknown-linux-gnu'
1.31.0-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04)
$ rustup component add rustfmt
info: downloading component 'rustfmt'
3.2 MiB / 3.2 MiB (100 %) 1.1 MiB/s ETA: 0 s
info: installing component 'rustfmt'
But still does not work with "stable":
$ rustup default stable
info: using existing install for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04)
$ rustup component add rustfmt
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rustfmt' for target 'x86_64-unknown-linux-gnu'
EDIT:
rustup toolchain remove stable && rustup toolchain add stable
fixed the problem.
I could also fix this issue by removing and adding stable again.
Thanks
clippy and rustfmt are also missing for x86_64-unknown-freebsd:
error: component 'rustfmt' for target 'x86_64-unknown-freebsd' is unavailable for download
Had a lot of jobs in Travis start failing recently because of this too: https://travis-ci.org/bspeice/qadapt/jobs/465480502
FWIW I had to run the following to get to a working state.
rustup toolchain remove stable && rustup toolchain install stable
FWIW I had to run the following to get to a working state.
rustup toolchain remove stable && rustup toolchain install stable
This worked for me. Thank you!
clippy and rustfmt are also missing for x86_64-unknown-freebsd:
error: component 'rustfmt' for target 'x86_64-unknown-freebsd' is unavailable for download
I see this with clippy on nightly x86_64-apple-darwin:
> rustup component add --toolchain nightly clippy
error: component 'clippy' for target 'x86_64-apple-darwin' is unavailable for download
However, I don't see it with rustfmt:
> rustup component add --toolchain nightly rustfmt
info: component 'rustfmt' for target 'x86_64-apple-darwin' is up to date
Regardless, it isn't unclear that it's the same issue, since this issue was originally that the stable toolchain "does not contain component", whereas this error message says it's "unavailable for download."
Regardless, it isn't unclear that it's the same issue, since this issue was originally that the stable toolchain "does not contain component", whereas this error message says it's "unavailable for download."
Indeed, it's unrelated. My issue is that clippy is actually unavailable for today's nightly, per https://mexus.github.io/rustup-components-history/x86_64-apple-darwin.html.
Went with rustup toolchain remove nightly && rustup toolchain add nightly instead - seems ok
Went with
rustup toolchain remove nightly && rustup toolchain add nightlyinstead - seems ok
What happens if you then rustup component add --toolchain nightly rustfmt || rustup component add --toolchain nightly clippy? On my system, I get:
> rustup component add --toolchain nightly rustfmt || rustup component add --toolchain nightly clippy
error: component 'rustfmt' for target 'x86_64-apple-darwin' is unavailable for download
info: backtrace:
stack backtrace:
…
error: component 'clippy' for target 'x86_64-apple-darwin' is unavailable for download
info: backtrace:
stack backtrace:
…
Which makes sense, given that both rustfmt and clippy are missing from today's nightly according to https://mexus.github.io/rustup-components-history/x86_64-apple-darwin.html.
Had the same issue with rustc 1.33.0 on Darwin (macos Mojave) and fish shell.
Following the consensus (rustup toolchain remove nightly && rustup toolchain add nightly) from the comments above seems to fail, so I guess what does apply to nightly applies to 1.33 as well.
$ cargo clippy
error: toolchain 'stable-x86_64-apple-darwin' does not have the binary `cargo-clippy`
$ rustup toolchain remove stable; and rustup toolchain add stable
info: uninstalling toolchain 'stable-x86_64-apple-darwin'
info: toolchain 'stable-x86_64-apple-darwin' uninstalled
info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: latest update on 2019-02-28, rust version 1.33.0 (2aa4c46cf 2019-02-28)
info: downloading component 'rustc'
78.7 MiB / 78.7 MiB (100 %) 7.9 MiB/s ETA: 0 s
info: downloading component 'rust-std'
51.5 MiB / 51.5 MiB (100 %) 12.4 MiB/s ETA: 0 s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
stable-x86_64-apple-darwin installed - rustc 1.33.0 (2aa4c46cf 2019-02-28)
$ cargo clippy
error: toolchain 'stable-x86_64-apple-darwin' does not have the binary `cargo-clippy`
@jxub I think you just need to re-install cargo-clippy via rustup component add clippy.
I have the same issue with a fresh install of freeBSD.
rustup
% curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh :(
info: downloading installer
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
It will add the cargo, rustc, rustup and other commands to
Cargo's bin directory, located at:
/home/irevoire/.cargo/bin
This can be modified with the CARGO_HOME environment variable.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
/home/irevoire/.rustup
This can be modified with the RUSTUP_HOME environment variable.
This path will then be added to your PATH environment variable by
modifying the profile files located at:
/home/irevoire/.profile
/home/irevoire/.zprofile
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-unknown-freebsd
default toolchain: stable
profile: default
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>
info: profile set to 'default'
info: syncing channel updates for 'stable-x86_64-unknown-freebsd'
info: latest update on 2019-09-26, rust version 1.38.0 (625451e37 2019-09-23)
error: some components unavailable for download for channel stable: 'clippy', 'rustfmt'
If you require these components, please install and use the latest successful build version,
which you can find at
Is there any way to ignore clippy and rustfmt ? I just want to run cargo and rustc...
I've a fix in-train which will solve this hopefully (forcing the toolchain during rustup installation)
Similar
$ rustup component add clippy
error: component 'clippy' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel 'nightly'
If you require these components, please install and use the latest successful build version,
which you can find at https://rust-lang.github.io/rustup-components-history.After determining the correct date, install it with a command such as:
rustup toolchain install nightly-2018-12-27Then you can use the toolchain with commands such as:
cargo +nightly-2018-12-27 buildinfo: backtrace:
stack backtrace:
0: error_chain::backtrace::imp::InternalBacktrace::new::hce2152fbda3838f5 (0x55793ed2743f)
1: rustup::dist::manifestation::Manifestation::update::h89b2eb500f143b9e (0x55793eb752e4)
2: rustup::toolchain::Toolchain::add_component::h10a462ae7dceea74 (0x55793ebd1d8a)
3: rustup_init::rustup_mode::main::he9fe9da5dd975fa2 (0x55793ea3e4b1)
4: rustup_init::run_rustup_inner::he53811fff1e7eab0 (0x55793ea729fc)
5: rustup_init::main::h97ff2dbfca1e75eb (0x55793ea71f86)
6: std::rt::lang_start::{{closure}}::h7aa1c35ed221d19e (0x55793ea0e273)
7: main (0x55793ea76e8e)
8: __libc_start_main (0x7f0a02a3909b)
9:(0x55793ea0a029)
The suggested commands didn't help.
Rustup 1.20.2 fixed the initial install hiccoughs, and beyond that, stable is now guaranteed to have the tooling components whereas nightly is not. I'm closing this issue as a result.
If you have further issues, please open fresh issues with full explanations of what you're doing and what you hoped would happen.
Most helpful comment
But:
But still does not work with "stable":
EDIT:
fixed the problem.