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

Viewed 9063

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.

6 Answers

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"

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

On Windows:

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

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

cargo default stable

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

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