Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'code' not found WSL - Microsoft VS Code #9838

Open
kkhan2023 opened this issue May 1, 2024 · 5 comments
Open

'code' not found WSL - Microsoft VS Code #9838

kkhan2023 opened this issue May 1, 2024 · 5 comments
Assignees
Labels
info-needed Issue requires more information from poster wsl Issue in vscode-remote WSL

Comments

@kkhan2023
Copy link

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
@VSCodeTriageBot VSCodeTriageBot added the wsl Issue in vscode-remote WSL label May 2, 2024
@aeschli
Copy link
Contributor

aeschli commented May 2, 2024

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 aeschli added the info-needed Issue requires more information from poster label May 2, 2024
@kkhan2023
Copy link
Author

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.

@khushal123
Copy link

khushal123 commented Jun 15, 2024

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

@aeschli
Copy link
Contributor

aeschli commented Jun 17, 2024

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.

@khushal123
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster wsl Issue in vscode-remote WSL
Projects
None yet
Development

No branches or pull requests

4 participants