swellaby / vscode-rust-test-adapter

Rust Test Explorer extension for VS Code
MIT License
56 stars 10 forks source link

`/bin/sh: cargo: command not found` #329

Closed Banyc closed 1 year ago

Banyc commented 1 year ago

I'm using the macOS system. The Rust Explorer Log said:

[...] [INFO] Test Explorer found
[...] [INFO] Initializing Rust adapter
[...] [INFO] Loading Rust Tests
[...] [DEBUG] Unable to parse cargo metadata output. Details: Error: Command failed: cargo metadata --no-deps --format-version 1
/bin/sh: cargo: command not found

According to the amount of emojis at https://github.com/electron/electron/issues/7688#issuecomment-255640358, it seems like macOS and Linux systems see this problem frequently. The comment provided https://github.com/sindresorhus/fix-path as a solution. I don't have an npm environment installed so not sure if that will fix the problem but hey according to those emojis...

calebcartwright commented 1 year ago

Thanks for reaching out. Can you first confirm that cargo is on your path, as detailed in the under the "Configuring the PATH environment variable" section on https://www.rust-lang.org/tools/install? You should be able to do this from any terminal and running something like cargo --version

Banyc commented 1 year ago

Thanks! Running the install script and then relaunching vscode fixes the problem!