New user here. I closely followed the installation instructions at https://rocket.rs/guide/overview/#routing.
I'm getting the following error:
no default toolchain configured
when I run the following command.
sudo ROCKET_ENV=stage cargo run
Are you using Rustup? And to use ROCKET_ENV you need to have a Rocket.toml where your Cargo.toml. This is covering it.
@impowski You don't need a Rocket.toml file to use the ROCKET_ENV variable. There are default values for all parameters, as mentioned in the documentation you linked.
@reportbase Did you follow https://rocket.rs/guide/getting-started/? In particular, the command rustup default nightly should resolve your issue.
@SergioBenitez Ah, forgot about default.
Just want to chime in that the problem is rustup is a user installation and is affecting only your user's profile (perhaps this operates differently on Mac). I actually have the same issue.
Something like using env_keep is needed here. I'd be nice if rustup took care of this automatically but it'd require sudo permissions and they wanted to avoid that.
@reportbase As a work-around you can do
sudo env "PATH=$PATH" ROCKET_ENV=stage cargo run
When I run:
rustup default nightly
rustc -V
the following is returned:
rustc 1.16.0-nightly (a52da95ce 2017-01-20)
When I run:
sudo env "PATH=$PATH" ROCKET_ENV=stage cargo run
the following is returned:
error: no default toolchain configured
@SergioBenitez
When I run:
rustup default nightly
the following is returned:
info: using existing install for 'nightly-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'
nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.16.0-nightly (a52da95ce 2017-01-20)
@reportbase This question is related to rustup, so try to ask there or read their guide on it.
@reportbase I'm going to guess something is up from your rustc / rustup configuration. I don't know enough about that to answer in more detail. Sorry, I did have the same problem as you and my work around worked for me.
If you run cargo with sudo involved and you installed rust via rustup then it executes that command as root. Since root hasn't installed cargo or rust then it will fail. You'll need to install rust via rustup for root as well so you can run sudo commands.
@reportbase Have any of these suggestions resolved your issue?
Let us know if you weren't able to get this working, @reportbase!
I have the same issue on arch linux and did this: sudo rustup default nightly-2017-03-16 to solve, which helped.
It installed everything again, so I think I have 2 installations of rust now, but don't know how to launch stage otherwise. The nightly-2017-03-16 is because of this