Skip to content

Installation instructions outdated #3271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Julian-Wollersberger opened this issue Dec 28, 2018 · 5 comments
Closed

Installation instructions outdated #3271

Julian-Wollersberger opened this issue Dec 28, 2018 · 5 comments

Comments

@Julian-Wollersberger
Copy link

I tried installing rustfmt, but the installation instructions in the README.md seem outdated and I couldn't figure out how to install rustfmt correctly.
I tried:

$ cargo install rustfmt
error: binary `cargo-fmt` already exists in destination
binary `rustfmt` already exists in destination
Add --force to overwrite

This is the first time I tried using rustfmt. Is is normally preinstalled?
(I also tried installing with --force)

$ cargo fmt
error: 'cargo-fmt' is not installed for the toolchain 'stable-x86_64-unknown-linux-gnu'
To install, run `rustup component add rustfmt`
$ rustup component add rustfmt
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rustfmt' for target 'x86_64-unknown-linux-gnu'

At least the error message tried ^^

$ rustup install nightly
$ cargo +nightly install --force rustfmt
$ cargo +nightly fmt
This version of rustfmt is deprecated. Use rustfmt-nightly. Use --force to run deprecated rustfmt.

Aparrently, I installed the wrong version. But:

$ rustup component add rustfmt --toolchain nightly
info: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is up to date

My setup:

Linux (Ubuntu 18.04)
rustup 1.16.0 (beab5ac2b 2018-12-06)
rustc 1.31.1 (b6c32da9b 2018-12-18)
cargo 1.31.0 (339d9f9c8 2018-11-16)

Can someone correct the installation instructions in the README.md? Thank you ^^

@Julian-Wollersberger
Copy link
Author

Julian-Wollersberger commented Dec 28, 2018

I was able to figure it out myself :)
Aparrently the right command was

cargo +nightly install --force rustfmt-nightly

And it can be used with cargo fmt, the +nightly isn't necessary.

@nrc
Copy link
Member

nrc commented Jan 7, 2019

You should use rustup component add rustfmt which is what is in the README. I think you might be looking at an old version of the readme.

@nrc nrc closed this as completed Jan 7, 2019
@ZaneA
Copy link

ZaneA commented Jan 8, 2019

Sorry to reopen but I've run into this as well, rustup component add rustfmt doesn't appear to work for me:

$ rustup --version
rustup 1.16.0 (beab5ac2b 2018-12-06)
$ rustc --version
rustc 1.31.1 (b6c32da9b 2018-12-18)
$ rustup component add rustfmt
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rustfmt' for target 'x86_64-unknown-linux-gnu'

I had done a rustup update earlier today to get to 1.31 and didn't have rustfmt installed previously.

@nrc
Copy link
Member

nrc commented Jan 10, 2019

You might need to do rustup self update, its also possibly a bug in Rustup

@ZaneA
Copy link

ZaneA commented Jan 10, 2019

Thank you, it does appear to be a bug in Rustup, the solution at rust-lang/rustup#1558 (comment) solved the problem for me:

rustup toolchain remove stable && rustup toolchain install stable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants