I have Rust installed using WSL2 Ubuntu I have alredy ran basic commands like hello world in rust so cargo is working. I wanted to download the rust-analyzer in VSCODE but I keep getting that error message from the title: rust-analyzer failed to load workspace: "cargo" "--version" failed: program not found
I tried ensuring all paths are correct, all vesions of extension and vscode and rust are up to date. several uninstall re-installs and rustup updates. Toolchain is using stable version. I have reviewed a lot of the other post about this accross all platforms but it seems I can not find the fix. It would be very helpful to get some guidance. Thank you!st
The solution is to open folder as if in WSL.
open WSL folder
and open folder with your rust project or just open new WSL window
rust-analyzer
and hit installMore info regarding the development on WSL can be found here
another good option is open your wsl, move to the project folder and type $ code.
or $ code YOUR_PROJECT
, then install rust-analyzer extension
Remove the rustc
and cargo
provide by system package manager (eg apt
).
Install them from offical rustup script instead.
[note]
I just encounter the same problem when using flatpak version of Lapce .
rust-analyzer failed to load workspace: "cargo" "--version" failed: No such file or directory (os error 2)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.