suj1th
suj1th

Reputation: 1801

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.

Upvotes: 27

Views: 11794

Answers (7)

kobencry
kobencry

Reputation: 1

for windows user

step 1: open terminal cmd or powersheell install: command> rustup component add rust-analyzer

settings coc-settings.json: "rust-client.rustupPath": "C:/Users/Useryou/.cargo/bin/rust-analyzer"

Upvotes: 0

Daniel Vaughan
Daniel Vaughan

Reputation: 21

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

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

Upvotes: 0

remjx
remjx

Reputation: 4610

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.

Upvotes: 1

Justin
Justin

Reputation: 406

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

Upvotes: 3

Cuong Nguyen
Cuong Nguyen

Reputation: 35

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

cargo default stable

Upvotes: 0

rofrol
rofrol

Reputation: 15276

On Windows:

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

Upvotes: 0

suj1th
suj1th

Reputation: 1801

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"

Upvotes: 43

Related Questions