I'm using vscode in Ubuntu WSL, it was working fine a couple of hours ago and suddenly stopped working as I started writing js.
I have tried deleting and reinstalling vscode but that does not work and an error : Unable to locate package code appears when I try to purge.
When connecting vscode to wsl remotely error appears as follows:
2020-09-30 09:20:11.585] Resolving wsl+Ubuntu, resolveAttempt: 1
[2020-09-30 09:20:11.625] Starting VS Code Server inside WSL (Ubuntu)
[2020-09-30 09:20:11.625] Extension version: 0.44.5, Windows build: 19041. Multi distro support: available. WSL path support: enabled
[2020-09-30 09:20:11.756] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c "[ -d ~/.vscode-server/bin/e5e9e69aed6e1984f7499b7af85b3d05f9a6883a ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2020-09-30 09:20:11.886] Probing result: found
[2020-09-30 09:20:11.886] Server install found in WSL
[2020-09-30 09:20:11.887] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" e5e9e69aed6e1984f7499b7af85b3d05f9a6883a stable .vscode-server 0 ' in c:\Users\divya\.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.5}
[2020-09-30 09:20:11.996] Setting up server environment: Looking for /home/dgoel/.vscode-server/server-env-setup. Not found.
[2020-09-30 09:20:11.996] WSL version: 4.4.0-19041-Microsoft Ubuntu
[2020-09-30 09:20:11.996] Starting server: /home/dgoel/.vscode-server/bin/e5e9e69aed6e1984f7499b7af85b3d05f9a6883a/server.sh --port=0 --use-host-proxy --fileWatcherPolling=0
[2020-09-30 09:20:11.996] /mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts/wslServer.sh: 63: /home/dgoel/.vscode-server/bin/e5e9e69aed6e1984f7499b7af85b3d05f9a6883a/server.sh: not found
[2020-09-30 09:20:11.997] VS Code Server for WSL closed unexpectedly.
[2020-09-30 09:20:11.997] For help with startup problems, go to
[2020-09-30 09:20:11.997] https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
here's the debug report from wsl ubuntu:
VSCODE_WSL_DEBUG_INFO=true code .
+ COMMIT=e5e9e69aed6e1984f7499b7af85b3d05f9a6883a
+ APP_NAME=code
+ QUALITY=stable
+ NAME=Code
+ DATAFOLDER=.vscode
+ realpath /mnt/c/Users/divya/AppData/Local/Programs/Microsoft VS Code/bin/code
+ dirname /mnt/c/Users/divya/AppData/Local/Programs/Microsoft VS Code/bin/code
+ dirname /mnt/c/Users/divya/AppData/Local/Programs/Microsoft VS Code/bin
+ VSCODE_PATH=/mnt/c/Users/divya/AppData/Local/Programs/Microsoft VS Code
+ ELECTRON=/mnt/c/Users/divya/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/divya/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js
+ CLI=C:/Users/divya/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/divya/AppData/Local/Programs/Microsoft VS Code/Code.exe C:/Users/divya/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\divya\.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.5
+ [ -n c:\Users\divya\.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.5 ]
+ wslpath -u c:\Users\divya\.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.5
+ WSL_CODE=/mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts/wslCode.sh
+ /mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts/wslCode.sh e5e9e69aed6e1984f7499b7af85b3d05f9a6883a stable /mnt/c/Users/divya/AppData/Local/Programs/Microsoft VS Code/Code.exe code .vscode .
+ [ -z .vscode ]
+ echo .vscode
+ sed -e s/.vscode/.vscode-server/g
+ DATAFOLDER=.vscode-server
+ VSCODE_REMOTE_BIN=/home/dgoel/.vscode-server/bin
+ AUTHORITY=wsl+default
+ [ Ubuntu ]
+ AUTHORITY=wsl+Ubuntu
+ [ ! -d /home/dgoel/.vscode-server ]
+ dirname /mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts/wslCode.sh
+ /mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts/wslDownload.sh e5e9e69aed6e1984f7499b7af85b3d05f9a6883a stable /home/dgoel/.vscode-server/bin
+ [ ! -d /home/dgoel/.vscode-server/bin/e5e9e69aed6e1984f7499b7af85b3d05f9a6883a ]
+ RC=0
+ [ 0 -ne 0 ]
+ dirname /mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts/wslCode.sh
+ VSCODE_CLIENT_COMMAND=/mnt/c/Users/divya/AppData/Local/Programs/Microsoft VS Code/Code.exe VSCODE_CLIENT_COMMAND_CWD=/mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts VSCODE_CLI_AUTHORITY=wsl+Ubuntu /home/dgoel/.vscode-server/bin/e5e9e69aed6e1984f7499b7af85b3d05f9a6883a/bin/code .
/mnt/c/Users/divya/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.5/scripts/wslCode.sh: 53: /home/dgoel/.vscode-server/bin/e5e9e69aed6e1984f7499b7af85b3d05f9a6883a/bin/code: not found
+ exit 127
You might need to set up your WSL again or upgrade to WSL2. Here is a helpful link: https://docs.microsoft.com/en-us/windows/wsl/install-win10
Or try this link: https://code.visualstudio.com/docs/remote/wsl-tutorial#:~:text=Run%20Terminal%20%3E%20New%20Terminal%20(Ctrl,VS%20Code%20running%20on%20Windows. It's mostly for running Python on vscode, but it might work if you follow the 'Intergrated Terminal' steps.