VS Code remote to WSL /bin/code-server: not found
Asked Answered
N

2

5

I have recently moved my WSL installation to another drive for disk space sake by using this guide: medium.

After it, when I try to open a remote window on VS Code I get the error:

/mnt/c/Users/User/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.2/scripts/wslServer.sh: 50: /root/.vscode-server/bin/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/bin/code-server: not found

Actually on /root/.vscode-server there is no bin directory but I cannot get why.

By using WSL from a windows prompt it opens normally.

What I messed up?

Nit answered 30/5, 2024 at 21:43 Comment(0)
D
13

TLDR: just rename or delete the .vscode-server/ folder in your wsl distro, it must be in the root, otherwise when connecting to wsl, vscode would attempt to install itself on you wsl distro.

I came across a similar situation, I did have the .vscode-server/ folder in the root though.

ATENTION: What I did made me lose my vscode extensions installed in wsl, wasn't a big deal for me but may be for your case.

To solve my issue:

  • I opened the terminal in the wsl distro I was using for vscode;
  • Checked if i had the folder by running the commandcd ~/.vscode-server;
  • I did have it, so I just renamed it (non destructive) to ".old_vscode-server";
  • Then just opened a new vscode instance and connected to wsl, it installed vscode server again, but without my previous extensions;
Davao answered 17/6, 2024 at 9:31 Comment(2)
This worked thanks!Interchange
thanks the only answer I found that helps with this issue right now I just used the 'mv' command in the wsl terminal but Im sure just removing the vs code server would workd tooBurundi
B
1

Simply delete ~/.vscode-server/bin/dc96b837cf6bb4af9cd736aa3af08cf8279f7685, then reopen VS code. This fixed the same error in my pc without losing the installed extensions.

Beanstalk answered 2/9, 2024 at 15:0 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.