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 2 months ago • 5 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