VSCode |由于意外错误,编辑器无法打开

问题描述 投票:0回答:7

目标:在终端中获取常规 Bash 和 Git,用于 Visual Studio Code 中的 Python 项目。

每次启动时,我都会看到此错误。我无法打开代码或使用终端。

错误信息:

The editor cannot be opened due to an unexpected error: No file system provider found for resource 'vscode-remote://wsl%2Bubuntu/...'

更新:卸载WSL。我不再有下面的旧终端输出。

终端:

[2022-06-13 15:53:18.277] Resolving wsl+ubuntu, resolveAttempt: 1
[2022-06-13 15:53:18.361] Starting VS Code Server inside WSL (wsl1)
[2022-06-13 15:53:18.361] Extension version: 0.66.3
[2022-06-13 15:53:18.361] Windows build: 19044. Multi distro support: available. WSL path support: enabled
[2022-06-13 15:53:18.361] No shell environment set or found for current distro.
[2022-06-13 15:53:18.546] WSL daemon log file: 
[2022-06-13 15:53:18.548] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c "[ -d ~/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2022-06-13 15:53:19.023] Probing result: x86_64
[2022-06-13 15:53:19.024] No server install found in WSL, needs linux-x64
[2022-06-13 15:53:19.024] Downloading server on client side to C:\Users\dabell\AppData\Local\Temp\vscode-remote-wsl\c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5\vscode-server-stable-linux-x64.tar.gz.
[2022-06-13 15:53:19.024] https://update.code.visualstudio.com/commit:c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/server-linux-x64/stable
[2022-06-13 15:53:26.719] Unable to download server on client side: Error: Request downloadRequest failed with message: getaddrinfo ENOTFOUND update.code.visualstudio.com. Will try to download on WSL side.
[2022-06-13 15:53:26.721] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=1433349295-3472956524-2784734323-674824766 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2022-06-13 15:53:27.103] Setting up server environment: Looking for /home/danielbellhv/.vscode-server/server-env-setup. Not found.
[2022-06-13 15:53:27.104] WSL version: 4.4.0-19041-Microsoft Ubuntu
[2022-06-13 15:53:27.104] Updating VS Code Server to version c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
[2022-06-13 15:53:27.104] Removing previous installation...
[2022-06-13 15:53:27.104] Installing VS Code Server for x64 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5)
[2022-06-13 15:53:27.104] Downloading:     
[2022-06-13 15:53:37.329] 100%
[2022-06-13 15:53:37.329] Failed
[2022-06-13 15:53:37.331] --2022-06-13 16:53:37--  https://update.code.visualstudio.com/commit:c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/server-linux-x64/stable
[2022-06-13 15:53:37.331] Resolving update.code.visualstudio.com (update.code.visualstudio.com)... 
[2022-06-13 15:53:47.093] failed: Temporary failure in name resolution.
[2022-06-13 15:53:47.093] wget: unable to resolve host address ‘update.code.visualstudio.com’
[2022-06-13 15:53:47.093] ERROR: Failed to download https://update.code.visualstudio.com/commit:c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/server-linux-x64/stable to /home/danielbellhv/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5-1655135606.tar.gz
[2022-06-13 15:53:47.094] VS Code Server for WSL closed unexpectedly.
[2022-06-13 15:53:47.094] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2022-06-13 15:53:47.116] WSL Daemon exited with code 0
visual-studio-code windows-10 windows-subsystem-for-linux wsl-2
7个回答
8
投票

可以通过重启WSL容器的网络来暂时解决这个问题。

以管理员身份打开 Powershell 并运行以下命令:

Restart-Service LxssManager

我建议将其保存到诸如

restart-WSL-network.ps1
之类的脚本中,并设置一个快捷方式以在再次发生时运行它。


6
投票

从 Windows 命令行运行

wsl --shutdown
并重新启动 vscode 解决了我的问题。


5
投票

删除主目录(在 wsl 中)中的 .vscode* 文件夹修复了问题


4
投票

我参加聚会有点晚了,但我今天才遇到这个问题。我只重新启动了Windows,现在一切正常了!


0
投票

有东西挂给我了。无法重新启动 wsl,因此重新启动 PC,确保 wsl 正在运行,然后 docker(如果您使用的是 docker,并且 vscode 可以正常打开)。


0
投票

我也遇到了同样的问题,是由于 Ubuntu 安装损坏造成的;基本上,Ubuntu 安装被强制中止,但一些配置仍然保留,我可以看到

wsl --list
命令列出的发行版。

我手动注销了发行版,在 Powershell 中发出以下命令:

wsl --unregister Ubuntu

之后,我也检查了

wsl --list
以确保:

  1. 有问题的发行版不再存在并且

  2. 默认发行版是正确的)

然后一切又开始正常工作了。


-1
投票

我只是从 Windows 应用商店卸载并重新安装了 WSL 2。

您可以通过。命令行,但我发现使用 Windows 应用商店更易于访问/用户友好。

© www.soinside.com 2019 - 2024. All rights reserved.