Closed travistrue2008 closed 4 years ago
I think cargo is not on your PATH, can you try running Code from the terminal?
There are a couple of older issues for the same error.
Yeah, I included cargo
in my PATH
, and cargo
would be a recognized command in the VSCode's integrated terminal. When I echo $PATH
, I get this for output:
/home/travis/.cargo/bin:/sbin:/bin:/usr/sbin:/usr/bin:/snap/bin
I did not try launching VSCode via terminal, yet though. I tried your suggestion of launching VSCode from the terminal, and that seemed to work. Not sure why that works, but Rust Analyzer is working now.
Thanks!
See #1811, #2496, #1533 or #3118. Code doesn't read your .profile
file, but the integrated terminal does because it spawns a shell.
We absolutelly should give a specific "cargo is not in your PATH" error in this case, it's such a common stumbling block.
On Wed, 8 Apr 2020 at 19:02, Laurențiu Nicola notifications@github.com wrote:
See #1811 https://github.com/rust-analyzer/rust-analyzer/issues/1811,
2496 https://github.com/rust-analyzer/rust-analyzer/issues/2496, #1533
https://github.com/rust-analyzer/rust-analyzer/issues/1533 or #3118 https://github.com/rust-analyzer/rust-analyzer/issues/3118. Code doesn't read your .profile file, but the integrated terminal does because it spawns a shell.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rust-analyzer/rust-analyzer/issues/3885#issuecomment-611076214, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANB3M2DOHHBROANPBLKEMLRLSU3BANCNFSM4MDQZHQQ .
I agree...It would be very nice to have a specific error message for this. I just set up a new system and must have done it wrong and ran into this issue...
A more precise error message would have saved me quite a bit of time / annoyance finding this.
I think "failed to run cargo metadata
" is as precise as we can be. I think we now auto-detect rustup-installed toolchains, so if you hit this, you're using a distro toolchain (which should be in PATH
anyway), Flatpak or some other weird setup that we can't even imagine.
I'm working with
rust-analyzer
on Solus, and I keep getting this error whenever I open my workspace in VSCode:The error kind of sounds like it either can't find the Cargo.toml file at that path, or it's missing manifest information? The Cargo.toml file is definitely at that path. Here's what it looks like:
I'm not sure if it's an issue with my project or not because my Rust workspace project seemed to work fine with Rust Analyzer in my WSL installation. It seems like Rust Analyzer isn't running at all as a result of this.
I followed the installation instructions for the VSCode extension, and clicked the Download Now button when prompt. I also tried the suggestion in that error, and ran
cargo metadata --manifest-path /home/travis/rust/rpg/Cargo.toml
. I got a ton of output in my terminal, but it didn't appear that Rust Analyzer was running. It wouldn't get rid of that error whenever I closed and reopened VSCode either. Finally, I completely uninstalled Rust, and reinstalled it viarustup
.Is there anything that I could be overlooking?