OS: macOS High Siera v10.13.1
Rust versions:
$ rustup show
Default host: x86_64-apple-darwin
installed toolchains
--------------------
stable-x86_64-apple-darwin
nightly-2019-06-08-x86_64-apple-darwin
active toolchain
----------------
stable-x86_64-apple-darwin (default)
rustc 1.35.0 (3c235d560 2019-05-20)
$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)
I went to the extension page in VS Code and clicked install. It asked if I wanted to install the Rust Language Server. I clicked "yes", and it opened up my terminal and started running commands:
> Executing task: rustup component add rust-analysis --toolchain stable-x86_64-apple-darwin <
info: component 'rust-analysis' for target 'x86_64-apple-darwin' is up to date
Terminal will be reused by tasks, press any key to close it.
> Executing task: rustup component add rust-src --toolchain stable-x86_64-apple-darwin <
info: component 'rust-src' is up to date
Terminal will be reused by tasks, press any key to close it.
> Executing task: rustup component add rls --toolchain stable-x86_64-apple-darwin <
error: toolchain 'stable-x86_64-apple-darwin' does not contain component 'rls' for target 'x86_64-apple-darwin'; did you mean 'rustc'?
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
It looked to me like the Rust language server isn't available with stable Rust, so I added a nightly toolchain and ran the command manually in my terminal:
$ rustup component add rls rust-analysis rust-src --toolchain nightly-2019-06-08-x86_64-apple-darwin
info: downloading component 'rls'
info: installing component 'rls'
info: downloading component 'rust-analysis'
info: installing component 'rust-analysis'
info: downloading component 'rust-src'
info: installing component 'rust-src'
The install seemed successful...
$ which rls
/Users/ahammes/.cargo/bin/rls
...so I tried to uninstall/reinstall the extension, but got the same original error.
I read other issues in the repo and tried the solution from #517 ("rust-client.channel": "stable"
), but had the same problem. Any ideas?
Reinstalling my stable toolchain worked:
$ rustup toolchain remove stable && rustup toolchain add stable
This is happening to me too:
OS: macOS Mojave 10.14.15
workbench.main.js:2379 Rustup not available. Install from https://www.rustup.rs/
onDidNotificationChange @ workbench.main.js:2379
_register.model.onDidNotificationChange.e @ workbench.main.js:2379
fire @ workbench.main.js:77
notify @ workbench.main.js:2435
notify @ workbench.main.js:3660
r @ workbench.main.js:3249
_showMessage @ workbench.main.js:3249
$showMessage @ workbench.main.js:3249
_doInvokeHandler @ workbench.main.js:3293
_invokeHandler @ workbench.main.js:3293
_receiveRequest @ workbench.main.js:3292
_receiveOneMessage @ workbench.main.js:3290
_protocol.onMessage.e @ workbench.main.js:3289
fire @ workbench.main.js:77
a @ workbench.main.js:322
e @ workbench.main.js:322
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:331
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:328
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:325
_register._socket.onData.e @ workbench.main.js:324
t @ workbench.main.js:333
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
workbench.main.js:2379 Couldn't start client Rust Language Server
onDidNotificationChange @ workbench.main.js:2379
_register.model.onDidNotificationChange.e @ workbench.main.js:2379
fire @ workbench.main.js:77
notify @ workbench.main.js:2435
notify @ workbench.main.js:3660
r @ workbench.main.js:3249
_showMessage @ workbench.main.js:3249
$showMessage @ workbench.main.js:3249
_doInvokeHandler @ workbench.main.js:3293
_invokeHandler @ workbench.main.js:3293
_receiveRequest @ workbench.main.js:3292
_receiveOneMessage @ workbench.main.js:3290
_protocol.onMessage.e @ workbench.main.js:3289
fire @ workbench.main.js:77
a @ workbench.main.js:322
e @ workbench.main.js:322
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:331
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:328
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:325
_register._socket.onData.e @ workbench.main.js:324
t @ workbench.main.js:333
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
workbench.main.js:238 [Extension Host] rejected promise not handled within 1 second: Error: spawn rustup ENOENT
t.log @ workbench.main.js:238
$logExtensionHostMessage @ workbench.main.js:3215
_doInvokeHandler @ workbench.main.js:3293
_invokeHandler @ workbench.main.js:3293
_receiveRequest @ workbench.main.js:3292
_receiveOneMessage @ workbench.main.js:3290
_protocol.onMessage.e @ workbench.main.js:3289
fire @ workbench.main.js:77
a @ workbench.main.js:322
e @ workbench.main.js:322
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:331
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:328
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:325
_register._socket.onData.e @ workbench.main.js:324
t @ workbench.main.js:333
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
workbench.main.js:238 [Extension Host] stack trace: Error: spawn rustup ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
at onErrorNT (internal/child_process.js:406:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
t.log @ workbench.main.js:238
$logExtensionHostMessage @ workbench.main.js:3215
_doInvokeHandler @ workbench.main.js:3293
_invokeHandler @ workbench.main.js:3293
_receiveRequest @ workbench.main.js:3292
_receiveOneMessage @ workbench.main.js:3290
_protocol.onMessage.e @ workbench.main.js:3289
fire @ workbench.main.js:77
a @ workbench.main.js:322
e @ workbench.main.js:322
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:331
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:328
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:325
_register._socket.onData.e @ workbench.main.js:324
t @ workbench.main.js:333
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
workbench.main.js:1406 ERR spawn rustup ENOENT: Error: spawn rustup ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
at onErrorNT (internal/child_process.js:406:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
rustup show
Default host: x86_64-apple-darwin
stable-x86_64-apple-darwin (default)
rustc 1.35.0 (3c235d560 2019-05-20)
➜ hello-world rustup -V
rustup 1.18.3 (435397f48 2019-05-22)
I tried the above and nothing 😞
I realized that there is an option to tell the extension where rustup is located:
"rust-client.rustupPath": "/Users/<user>/.cargo/bin/rustup"
I reloaded the window and VSCode asked me to install RLS (Which I already have installed) and it worked...
I also noticed in the VSCode log that RLS was installed using rustup. Now I have two rls exacutables...
➜ ~/.rustup/toolchains/stable-x86_64-apple-darwin/bin/rls -V
rls 1.35.0 (49efc06 2019-04-06)
➜ hello-world which rls
/Users/<user>/.cargo/bin/rls
➜ hello-world rls -V
rls 1.35.0 (49efc06 2019-04-06)
I don't know if this is something related to my environment (I am new to Rust and its tools), but hopefully, these details help to debug or discard the issue...
Output after fix:
[Extension Host] running with rustup: rls
workbench.main.js:238 [Extension Host] will use a rustup-installed RLS; ensuring present
workbench.main.js:238 [Extension Host] Setting sysroot to /Users/<user>/.rustup/toolchains/stable-x86_64-apple-darwin
Hopefully this will be fixed by #612 (to be released in the next version).
I reinstalled and added the rls again like @adamhammes said, it works now! Thanks! :D
I had a similar issue on macOS Mojave.
The install stumbled because it could not find rustup on the path:
> Executing task: rustup component add rust-analysis --toolchain stable-x86_64-apple-darwin <
zsh:1: command not found: rustup
The terminal process command '/bin/zsh -c 'rustup component add rust-analysis --toolchain stable-x86_64-apple-darwin'' failed to launch (exit code: 127)
Terminal will be reused by tasks, press any key to close it.
> Executing task: rustup component add rust-src --toolchain stable-x86_64-apple-darwin <
zsh:1: command not found: rustup
The terminal process command '/bin/zsh -c 'rustup component add rust-src --toolchain stable-x86_64-apple-darwin'' failed to launch (exit code: 127)
Terminal will be reused by tasks, press any key to close it.
> Executing task: rustup component add rls --toolchain stable-x86_64-apple-darwin <
zsh:1: command not found: rustup
The terminal process command '/bin/zsh -c 'rustup component add rls --toolchain stable-x86_64-apple-darwin'' failed to launch (exit code: 127)
Terminal will be reused by tasks, press any key to close it.
despite the path being properly set in my ~/.zshrc:
# rust
export PATH="$HOME/.cargo/bin:$PATH"
and rustup accessible in my zsh:
which rustup
/Users/Olivier/.cargo/bin/rustup
So as a workaround, I manually installed all 3 dependencies:
rustup toolchain list
stable-x86_64-apple-darwin (default)
rustup component add rust-analysis --toolchain stable-x86_64-apple-darwin
rustup component add rust-src --toolchain stable-x86_64-apple-darwin
rustup component add rls --toolchain stable-x86_64-apple-darwin
rustup component list | grep installed
rls-x86_64-apple-darwin (installed)
rust-analysis-x86_64-apple-darwin (installed)
rust-src (installed)
EDIT:
Upon further investigation this is due to my settings:
"terminal.integrated.env.osx": {
"PATH": ""
}
itself due to another VS Code issue https://github.com/Microsoft/vscode-python/issues/4434 workaround which I had to implement as I use conda envs.
Temporary removing this setting solves the problem
I had to manually install rust-analysis, rust-src, and rls from my terminal as described by @oscar6echo and then reload VSCode to get it to work.
I just added "rust-client.channel": "stable-x86_64-apple-darwin" in the settings.json
Most helpful comment
Reinstalling my stable toolchain worked: