'How do I solve "Couldn't start client Rust Language Server" with the Rust VS Code extension?

After installing the Rust extension for VS Code, building the project fails with the following error:

Error Message Displayed by vscode

Couldn't start client Rust Language Server

Rustup not available. Install from https://www.rustup.rs

This is in spite of the fact that rustup is installed in the system, and accessible from the VS Code terminal.



Solution 1:[1]

This is an oft-reported issue in the rls-vscode repository, and I found the solution buried in some of the discussions (1, 2).

The issue seems to be with the path to the rustup executable. rustup works fine on the terminal, but VS Code cannot locate it.

Adding the following to the setting.json of the extension fixes the path for the extension.

"rust-client.rustupPath": "/home/XXX/.cargo/bin/rustup"

Solution 2:[2]

@suj1th first cited approach fixed it for me.
Add: "rust-client.rustupPath": "$HOME/.cargo/bin/rustup" to your user settings.

Solution 3:[3]

Here is a debugging/troubleshooting guide: https://github.com/rust-lang/rls/blob/master/debugging.md

My fix was to launch VSCode from the terminal with code.

Solution 4:[4]

On Windows:

Start > search for "Edit environment variables for account" > Edit "Path" > Add "%USERPROFILE%\.cargo\bin"

Solution 5:[5]

I got this error when using nightly.
Set it back to stable, then it worked:

cargo default stable

Solution 6:[6]

I needed to add the Windows path (without $HOME) to get it to work.

"rust-client.rustupPath": "C:/Users/myusername/.cargo/bin/rustup"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shepmaster
Solution 2 Justin
Solution 3 Mark Jackson
Solution 4 rofrol
Solution 5 Cuong Nguyen
Solution 6 Daniel Vaughan