vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

'code' not found WSL - Microsoft VS Code

Open kkhan2023 opened this issue 1 year ago • 6 comments

Hello,

I have installed an instance of WSL2 and Microsoft VS code on my windows 11 machine. I have also installed WSL extension on VS code however when i type code in the Ubuntu/WSL terminal, it states that the file is 'not found'

I have ran the debug command and the output is as follows. Please can you asssist?

  • COMMIT=e170252f762678dec6ca2cc69aba1570769a5d39
  • APP_NAME=code
  • QUALITY=stable
  • NAME=Code
  • SERVERDATAFOLDER=.vscode-server
  • realpath /mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/bin/code
  • dirname /mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/bin/code
  • dirname /mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/bin
  • VSCODE_PATH=/mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code
  • ELECTRON=/mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/Code.exe
  • IN_WSL=false
  • [ -n Ubuntu ]
  • IN_WSL=true
  • [ true = true ]
  • export WSLENV=ELECTRON_RUN_AS_NODE/w:
  • wslpath -m /mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js
  • CLI=C:/Users/kasam/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js
  • WSL_EXT_ID=ms-vscode-remote.remote-wsl
  • ELECTRON_RUN_AS_NODE=1 /mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/Code.exe C:/Users/kasam/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js --locate-extension ms-vscode-remote.remote-wsl
  • cat /tmp/remote-wsl-loc.txt
  • WSL_EXT_WLOC=c:\Users\kasam.vscode\extensions\ms-vscode-remote.remote-wsl-0.88.0
  • [ -n c:\Users\kasam.vscode\extensions\ms-vscode-remote.remote-wsl-0.88.0 ]
  • wslpath -u c:\Users\kasam.vscode\extensions\ms-vscode-remote.remote-wsl-0.88.0
  • WSL_CODE=/mnt/c/Users/kasam/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.0/scripts/wslCode.sh
  • /mnt/c/Users/kasam/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.0/scripts/wslCode.sh e170252f762678dec6ca2cc69aba1570769a5d39 stable /mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/Code.exe code .vscode-server .
  • [ -z .vscode-server ]
  • [ .vscode-server = .vscode-insiders ]
  • [ ! -t 0 ]
  • VSCODE_REMOTE_BIN=/home/kasam/.vscode-server/bin
  • AUTHORITY=wsl+default
  • [ Ubuntu ]
  • AUTHORITY=wsl+Ubuntu
  • dirname /mnt/c/Users/kasam/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.0/scripts/wslCode.sh
  • /mnt/c/Users/kasam/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.0/scripts/wslDownload.sh e170252f762678dec6ca2cc69aba1570769a5d39 stable /home/kasam/.vscode-server/bin
  • [ ! -d /home/kasam/.vscode-server/bin/e170252f762678dec6ca2cc69aba1570769a5d39 ]
  • RC=0
  • [ 0 -eq 100 ]
  • [ 0 -ne 0 ]
  • mktemp /tmp/vscode-distro-env.XXXXXX
  • STORED_ENV=/tmp/vscode-distro-env.1lGfYA
  • env
  • dirname /mnt/c/Users/kasam/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.0/scripts/wslCode.sh
  • VSCODE_CLIENT_COMMAND=/mnt/c/Users/kasam/AppData/Local/Programs/Microsoft VS Code/Code.exe VSCODE_CLIENT_COMMAND_CWD=/mnt/c/Users/kasam/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.0/scripts VSCODE_CLI_AUTHORITY=wsl+Ubuntu VSCODE_CLI_REMOTE_ENV=/tmp/vscode-distro-env.1lGfYA VSCODE_STDIN_FILE_PATH= WSLENV=VSCODE_CLI_REMOTE_ENV/w:ELECTRON_RUN_AS_NODE/w: /home/kasam/.vscode-server/bin/e170252f762678dec6ca2cc69aba1570769a5d39/bin/remote-cli/code . /mnt/c/Users/kasam/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.0/scripts/wslCode.sh: 68: /home/kasam/.vscode-server/bin/e170252f762678dec6ca2cc69aba1570769a5d39/bin/remote-cli/code: not found
  • exit 127

kkhan2023 avatar May 01 '24 23:05 kkhan2023

Can you check if /home/kasam/.vscode-server/bin/e170252f762678dec6ca2cc69aba1570769a5d39/bin/remote-cli/code exists?

Maybe it got corrupted?

  • close all VS Code windows
  • in a WSL terminal, run rm -r ~/.vscode-server/bin
  • start VS Code again and open a WSL window

aeschli avatar May 02 '24 14:05 aeschli

Hello, Thanks for the tips.

I have now resolved this issue with the following steps:

'Code' not found

Within the WSL terminal, type rm -r ~/.vscode-server to delete the VS Code WSL server.

Exit the terminal and from your PowerShell/Cmd, run wsl --shutdown . Then you can log in back to your WSL and run code . and it should work normally.

kkhan2023 avatar May 06 '24 22:05 kkhan2023

I tried everything, it didnt work. I have to connect wsl manually but code command is unrecognized. this is what .vscode-remote looks like ksc@kschouhan:~/.vscode-server/bin/611f9bfce64f25108829dd295f54a6894e87339d$ ls -l total 94176 -rw-r--r-- 1 ksc ksc 13380 Jun 12 02:32 LICENSE drwxr-xr-x 4 ksc ksc 4096 Jun 12 02:33 bin drwxr-xr-x 34 ksc ksc 4096 Jun 12 02:33 extensions -rwxr-xr-x 1 ksc ksc 96338512 Jun 12 02:33 node drwxr-xr-x 86 ksc ksc 4096 Jun 12 02:33 node_modules drwxr-xr-x 3 ksc ksc 4096 Jun 12 02:33 out -rw-r--r-- 1 ksc ksc 116 Jun 12 02:31 package.json -rw-r--r-- 1 ksc ksc 51157 Jun 12 02:32 product.json

khushal123 avatar Jun 15 '24 10:06 khushal123

No bin/remote-cli/code ? Maybe try deleting ~/.vscode-server/bin/ again. There's an issue with extracting, but I haven't been able to hunt it down.

aeschli avatar Jun 17 '24 07:06 aeschli

I tried that many times. It seems its not issue for everyone, Even I am encountering it for first time. I tried uninstalling vscode and install again , with cache cleared.

khushal123 avatar Jun 17 '24 11:06 khushal123

Hey @aeschli, this issue might need further attention.

@kkhan2023, you can help us out by closing this issue if the problem no longer exists, or adding more information.