Vscode-rust: Error start RLS in version 0.6.1 with message "Rustup not available"

Created on 15 Apr 2019  路  20Comments  路  Source: rust-lang/vscode-rust

Not started RLS with update rustup

message:

[Error - 15:01:20] Starting client failed
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)

and plus this:

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

Before update rustup error message was same.

rls-vscode version = 0.6.1.
rustup version = rustup 1.17.0 (069c88ed6 2019-03-05)
vscode vesion = 1.33.1
rustc version = rustc 1.34.0 (91856ed52 2019-04-10)
os:

Distributor ID: LinuxMint
Description:    Linux Mint 19.1 Tessa
Release:    19.1
Codename:   tessa
P-High bug

Most helpful comment

I tried debugging this some. Sharing what I've found.
This fixes everything.

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

This seems to be an issue with the path.

echo $PATH

contains ~/.cargo/bin:
so I can run rustup --version fine in a shell.
However running the code below returns an error, the same error I got when debugging the extension.

const { execFile } = require('child_process');
const child = execFile('rustup', ['--version'], (error, stdout, stderr) => {
  if (error) {
    throw error;
  }
  console.log(stdout);
});
/*
throws error:

Error: spawn rustup ENOENT
    at _errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
*/

Which is the same way rustup is invoked in the extension here

UPDATE 1
Changing my $PATH with ~/.cargo/bin to an absolute path /home/XXX/.cargo/bin fixed my issues.
The above script then worked as well.
I could then remove all related vscode settings from settings.json and it worked seamlessly.

All 20 comments

Experiencing the same. Also running Linux Mint 19.1.

check in this os

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

normal working.

@jhzn you try uninstall/install vscode extension?

I'm using Fedora 29, VS Code from Flathub and Rust from official website. Reinstalling the extension did not resolve the issue.

Checking in with the following. Running VSCode from the icon and from the command line produces the same error.

VSCode: 1.33.1
rls-vscode: 0.6.1
macOS: 10.14.4
rustup: rustup 1.18.0 (8603e2c56 2019-04-22)
rustc: 1.31.1 (b6c32da9b 2018-12-18)

@Xanewok How you debugging this extension?
I am want try debugging on my machine.

I was experiencing the same issue. Adding the following to my plugin settings fixed it

"rust-client.rlsPath": "path_to_rls"

I tried debugging this some. Sharing what I've found.
This fixes everything.

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

This seems to be an issue with the path.

echo $PATH

contains ~/.cargo/bin:
so I can run rustup --version fine in a shell.
However running the code below returns an error, the same error I got when debugging the extension.

const { execFile } = require('child_process');
const child = execFile('rustup', ['--version'], (error, stdout, stderr) => {
  if (error) {
    throw error;
  }
  console.log(stdout);
});
/*
throws error:

Error: spawn rustup ENOENT
    at _errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
*/

Which is the same way rustup is invoked in the extension here

UPDATE 1
Changing my $PATH with ~/.cargo/bin to an absolute path /home/XXX/.cargo/bin fixed my issues.
The above script then worked as well.
I could then remove all related vscode settings from settings.json and it worked seamlessly.

I can confirm that the above works for me - setting the proper path to rustup solved my issues.

System details:
VSCode: 1.33.1
rls-vscode: 0.6.1
Windows 10 Professional v17134.753

my command

echo $PATH

print this:

/home/***/.cargo/bin:

Not work.

Ran into this issue too. I had rustup installed so the fix was just to restart VSCode because it was open before I installed rustup. Seems like a stupid error :')

My GNOME termimal read config file
.bashrc

# change PATH for support Rust.
export PATH="$HOME/.cargo/bin:$PATH"

command:

rustup --version

bash - work
vscode extension - not work

Added

export PATH="$HOME/.cargo/bin:$PATH"

in .bash_profile and drop from .bashrc

rerun command:

rustup --version

bash - not work
vscode extension - work

Conclusion
VSCode extension need change .bash_profile.

I had export PATH="$PATH:~/.cargo/bin" in my path. Changed it to export PATH="$PATH:$HOME/.cargo/bin" and now it works.

This not bug extension.
Bug:

  1. VsCode
  2. Rustup.

I've fixed same issue by adding the following setting to settings.json

// "~/.cargo/bin/rustup" does not work
"rust-client.rustupPath": "/absolute/path/to/.cargo/bin/rustup",

Having the same problem on MacOS Sierra. Running fine on bash rustup -V but installing RLS did not work. Add

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

solves the problem.

Ran into this issue too. I had rustup installed so the fix was just to restart VSCode because it was open before I installed rustup. Seems like a stupid error :')

Also, if you're on Mac, be sure you actually close the program and not just the windows. If you see the little dot beneath VS Code on the dock then it is still running. :)

Steps to fix:

  1. Shift-Control-P to open the command palette
  2. Type "User Settings" and hit enter
  3. Go to Extensions -> Rust
  4. Scroll down to "Rustup Path"
  5. Put your absolute path to rustup in the text box
  6. Reload the window: Shift-Control-P, type "Reload Window", and hit enter

Uninstalled Rust extension.
And installing Rust-analyzer fixed the issue for me.

Do a rustup update if you don't use rustup to manage your versions of rust packages and rust as well, I would suggest you to do so.

After rust is updated, make sure you install rust-analysis and few other packages that the vscode rls plugin uses.

To see your current components.

$ rustup component list | grep installed

Installing these packages should fix your issue. I agree this isn't the plugin's fault.

$ rustup component add rust-src rust-analysis
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexreg picture alexreg  路  3Comments

mcclure picture mcclure  路  4Comments

Tape-Worm picture Tape-Worm  路  4Comments

byteshiva picture byteshiva  路  4Comments

sfackler picture sfackler  路  6Comments