Cargo returns error: no default toolchain configured

Hi I'm an absolute noob
and I'm trying to get started with Rust
I'm on Ubuntu 18.04 I run in terminal
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
it failed to add ~/.cargo/bin to $PATH

error: could not amend shell profile: '/home/francesco/.bash_profile'
error: caused by: could not write rcfile file: '/home/francesco/.bash_profile'
error: caused by: Permission denied (os error 13)

so I did it myself,
and which rustup returns /home/francesco/.cargo/bin/rustup
rustup --version returns rustup 1.21.1 (7832b2ebe 2019-12-20)
which cargo returns /home/francesco/.cargo/bin/cargo

but...
~/projects$ cargo new hello returns error: no default toolchain configured
same for cargo --version , which rustc and rustc --version.

What did I miss?
Thanks in advance

Try running

rustup default stable

if that doesn't help, try reinstalling, but this time with acceptable permissions from the start. Perhaps it aborted before finishing the setup.

1 Like

Try the --no-modify-path flag of rustup-init.

francesco@francesco-yoga720:~$ rustup default stable
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-01-30, rust version 1.41.0 (5e1a79984 2020-01-27)
info: downloading component 'cargo'
  4.7 MiB /   4.7 MiB (100 %) 665.6 KiB/s in  7s ETA:  0s
info: downloading component 'clippy'
  1.8 MiB /   1.8 MiB (100 %) 429.4 KiB/s in  4s ETA:  0s
info: downloading component 'rust-docs'
 12.0 MiB /  12.0 MiB (100 %)   1.1 MiB/s in 17s ETA:  0s
info: downloading component 'rust-std'
 17.5 MiB /  17.5 MiB (100 %) 686.6 KiB/s in 26s ETA:  0s
info: downloading component 'rustc'
 57.9 MiB /  57.9 MiB (100 %)   1.0 MiB/s in  1m 18s ETA:  0s
info: downloading component 'rustfmt'
  3.1 MiB /   3.1 MiB (100 %) 1018.2 KiB/s in  3s ETA:  0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 12.0 MiB /  12.0 MiB (100 %)   9.0 MiB/s in  1s ETA:  0s
info: installing component 'rust-std'
 17.5 MiB /  17.5 MiB (100 %)  16.4 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 57.9 MiB /  57.9 MiB (100 %)  11.7 MiB/s in  5s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.41.0 (5e1a79984 2020-01-27)

francesco@francesco-yoga720:~$ which rustc
/home/francesco/.cargo/bin/rustc
francesco@francesco-yoga720:~$ rustc --version
rustc 1.41.0 (5e1a79984 2020-01-27)
francesco@francesco-yoga720:~$ cd projects
francesco@francesco-yoga720:~/projects$ cargo new hello
     Created binary (application) `hello` package
francesco@francesco-yoga720:~/projects$ 

everything looks fine now
thank you @kornel

the issue can be closed

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.