ubuntu 在wsl的终端中运行“code .”会产生错误

baubqpgj  于 2022-11-22  发布在  其他
关注(0)|答案(3)|浏览(255)

我最近安装了wsl并在终端中运行code .,我得到了这个错误:

Updating VS Code Server to version f80445acd5a3dadef24aa209168452a3d97cc326
Removing previous installation...
Installing VS Code Server for x64 (f80445acd5a3dadef24aa209168452a3d97cc326)
Downloading: 100%
Failed
--2022-03-01 20:19:21--  https://update.code.visualstudio.com/commit:f80445acd5a3dadef24aa209168452a3d97cc326/server-linux-x64/stable
Resolving update.code.visualstudio.com (update.code.visualstudio.com)... 40.64.128.224
Connecting to update.code.visualstudio.com (update.code.visualstudio.com)|40.64.128.224|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://az764295.vo.msecnd.net/stable/f80445acd5a3dadef24aa209168452a3d97cc326/vscode-server-linux-x64.tar.gz [following]
--2022-03-01 20:19:25--  https://az764295.vo.msecnd.net/stable/f80445acd5a3dadef24aa209168452a3d97cc326/vscode-server-linux-x64.tar.gz
Resolving az764295.vo.msecnd.net (az764295.vo.msecnd.net)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘az764295.vo.msecnd.net’
ERROR: Failed to download https://update.code.visualstudio.com/commit:f80445acd5a3dadef24aa209168452a3d97cc326/server-linux-x64/stable to /home/burbanox/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326-1646176740.tar.gz

我需要知道如何才能解决它,以便能够打开Visual Studio代码

p5cysglq

p5cysglq1#

我找到了一个比较正统的解决方案
1.首先通过窗口在本地打开Vscode
1.转到上半部分的视图,然后选择“命令调色板”
1.选择选项“远程-WSL:新建WSL窗口“

wwtsj6pe

wwtsj6pe2#

我也有同样的问题。
解决方法:
1.转到搜索栏并键入“Turn windows features on or off”(打开或关闭Windows功能),向下滚动到Windows Subsystem for Linux,然后取消选中它。
1.重新启动
1.返回“打开或关闭Windows功能”,它也可以位于控制面板中,并重新选中Windows子系统的框
1.重新启动
现在您可以打开命令提示符并键入:

wsl -l -v #this will verify which version you are running. mine remained the same at wsl 2. if it is not you can change it.
wsl --set-version Ubuntu20.04 2

1.打开Ubuntu命令行并尝试重新键入(code .),它应该会安装正确的软件包。

taylor@DESKTOP-TI4J8NI:~/Desktop/OS_Python$ code .                                                                                                             
Updating VS Code Server to version 3b889b090b5ad5793f524b5d1d39fda662b96a2a                                                                                    
Removing previous installation...                                                                                                                              
Installing VS Code Server for x64 (3b889b090b5ad5793f524b5d1d39fda662b96a2a)                                                                                   
Downloading: 100%                                                                                                                                              
Unpacking: 100%                                                                                                                                                
Unpacked 2822 files and folders to /home/taylor/.vscode- 
server/bin/3b889b090b5ad5793f524b5d1d39fda662b96a2a.

接下来,一切又对我起作用了。回顾:只需禁用并重新启用Windows Subsystem for Linux功能。

qvtsj1bj

qvtsj1bj3#

我按照这里的步骤来修复网络问题,之后它就能正常工作了。

相关问题