rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
52.69k stars 10.02k forks source link

Rustlings initialisation failed -- arch linux #2046

Closed Sitkaskidding closed 2 months ago

Sitkaskidding commented 2 months ago

I am attempting to follow the installation instructions on the README.However when entering the command rustlings init i get the error "-bash: rustlings: command not found". Any other variations of the rustlings command e.g. rustlings --help or rustlings --version produces the same output

Thank you very much for your time

mo8it commented 2 months ago

Can you please share the output of echo $PATH?

mo8it commented 2 months ago

Did you install Rust using pacman instead of rustup?

Can you please share the output of cat ~/.cargo/env and ls ~/.cargo/bin?

Sitkaskidding commented 2 months ago

To be perfectly honest I cannot remember if I installed Rust using pacman or rustup. Is there some way to check?

echo $PATH outputs /usr/local/bin:/usr/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin cat ~/.cargo/env outputs No such file or directory ls ~/.cargo/bin outputs mdbook rustlings

mo8it commented 2 months ago

It looks like Rust was installed using pacman and it didn't add ~/.cargo/bin to your PATH environment variable. You see that rustlings is already installed in ~/.cargo/bin but it can't be found. Either add ~/.cargo/bin manually to PATH or uninstall Rust from pacman and install it using the official way.

I will close the issue. But if you still need any help, don't hesitate to comment :)

mo8it commented 2 months ago

See this section and what it says about ~/.cargo/bin in PATH. I think that Arch should just add ~/.cargo/bin to your PATH as intended instead of doing things its own way…