我在Ubuntu WSL中使用vscode,几个小时前它还工作得很好,当我开始写js时突然停止工作。
我已经尝试删除并重新安装vscode,但不工作,并出现错误:尝试清除时出现“Unable to locate package code”(无法找到软件包代码)。
远程连接vscode到wsl时出现如下错误:
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
下面是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
6条答案
按热度按时间dvtswwa31#
也许比公认的答案更简单,我能够解决这个问题:
1.在Windows中启动vscode
1.更新remote-wsl扩展
1.关闭vscode
1.打开WSL
1.从WSL启动vscode
bvn4nwqk2#
您可能需要重新设置WSL或升级到WSL2。下面是一个有用的链接:https://learn.microsoft.com/en-us/windows/wsl/install-win10
或尝试此链接:这是一个在Windows上运行Python的程序,但是如果你按照“集成终端”的步骤操作,它可能会工作。
bhmjp9jg3#
这对我很有效--点击此链接:https://code.visualstudio.com/docs/remote/wsl-tutorial如果您不需要Python开发部分,请跳过它,然后转到在WSL中运行部分并运行:'code .'以安装VS程式码服务器。
然后打开VS代码并选择新的WSL窗口选择您的文件夹。
fwzugrvs4#
我想我在更新VSCode后也遇到过类似的问题。当我重新安装remote-wsl扩展并重新启动VSCode时,问题仍然存在。
后来我做了以下事情:
wsl --shutdown
来重新启动WSLsudo apt update
和sudo apt upgrade
)code .
)这可能与以下方面有关:VS Code connect to WSL Ubuntu 20.04 LTS, fail with error: Could not fetch remote environment🤔
sxpgvts35#
此命令对我有效
70gysomp6#
当我从GUI更新VS代码时也遇到了同样的问题。之后我就不能从WSL2启动它了。
对我来说修复它的是从WSL更新VS代码。
我怀疑有什么东西坏了,因为我通过VS代码GUI而不是通过apt更新了VS代码。