运行“代码”。在 wsl 的终端中产生错误

发布于 2025-01-10 22:58:56 字数 1376 浏览 0 评论 0原文

我最近安装了 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 Code

I recently installed wsl and running code . in the terminal I get this error:

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

I need to know how I can solve it to be able to open visual studio code

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

望喜 2025-01-17 22:58:57

我有完全相同的问题。

解决方案:

  1. 转到搜索栏并输入“打开或关闭 Windows 功能”,
    向下滚动到适用于 Linux 的 Windows 子系统,然后取消选中它。

  2. 重新启动

  3. 返回到“打开或关闭 Windows 功能”(也可以位于控制面板中),然后重新选中“适用于 Linux 的 Windows 子系统”复选框

  4. 重新启动

    现在您可以打开命令提示符并键入:

    wsl -l -v #这将验证您正在运行的版本。我的在 wsl 2 中保持不变。如果不是,您可以更改它。
    wsl --set-version Ubuntu20.04 2
    
  5. 打开 Ubuntu 命令行并尝试重新键入 (code .),它应该会安装正确的软件包。

    taylor@DESKTOP-TI4J8NI:~/Desktop/OS_Python$ 代码。                                                                                                             
    将 VS Code 服务器更新到版本 3b889b090b5ad5793f524b5d1d39fda662b96a2a                                                                                    
    删除以前的安装...                                                                                                                              
    安装适用于 x64 的 VS Code 服务器 (3b889b090b5ad5793f524b5d1d39fda662b96a2a)                                                                                   
    下载:100%                                                                                                                                              
    开箱率:100%                                                                                                                                                
    将 2822 个文件和文件夹解压到 /home/taylor/.vscode- 
    服务器/bin/3b889b090b5ad5793f524b5d1d39fda662b96a2a。 
    

在此之后,一切又开始为我工作了。回顾:只需禁用并重新启用适用于 Linux 的 Windows 子系统功能即可。

I had the exact same issue.

Solution:

  1. Go to the search bar and type "Turn windows features on or off",
    scroll down to Windows Subsystem for Linux, and uncheck it.

  2. Restart

  3. Go back to "Turn windows features on or off", which can also be located in the control panel, and recheck the box for Windows Subsystem for Linux

  4. Restart

    Now you can open to command prompt and type:

    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
    
  5. Open your Ubuntu command line and try retyping (code .) and it should install the proper packages.

    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. 
    

Following this, everything was working for me again. Recap: Just disable and re-enable the Windows Subsystem for Linux feature.

扬花落满肩 2025-01-17 22:58:57

经过恢复发现,我找到了解决这个问题的方法:

  1. 打开ThisPC
  2. 打开Linux
  3. 打开Ubuntu =>首页 =>找到文件夹 vscodeServer =>删掉
  4. 再通过代码安装vscodeServer。

这对我有用。

After recovery found, I found a solution to this problem:

  1. open ThisPC
  2. open Linux
  3. open Ubuntu => home => find folder vscodeServer => delete it
  4. again install vscodeServer by code.

It worked for me.

幻梦 2025-01-17 22:58:57

我按照此处的步骤修复网络问题,效果很好然后。

I followed the steps here to fix the networking issue and it works fine afterwards.

哆兒滾 2025-01-17 22:58:57

这与代理有关,但请始终确保尝试重新启动笔记本电脑,然后运行 ​​sudo update 和 sudo update ,检查代理,然后打开终端并输入代码。

This is related to proxy but always make sure you try to reboot the laptop, then run sudo update and sudo upgrade, check the proxy then open the terminal and type CODE.

忘东忘西忘不掉你 2025-01-17 22:58:56

我设法找到了一个有点正统的解决方案

  1. 首先通过 Windows 在本地打开 Vscode
  2. 转到上半部分的“查看”并选择“命令调色板”
  3. 选择选项“Remote-WSL:新 WSL 窗口”

I managed to find a somewhat orthodox solution

  1. First Open Vscode locally via windows
  2. Go to View in upper section and select "command palette"
  3. Select the option "Remote-WSL: New WSL Window "
笑忘罢 2025-01-17 22:58:56
  1. 从 Windows 打开 VS Code
  2. 打开命令面板 Ctrl + Shift + p
  3. 输入 WSL 并选择选项 WSL:使用 Distro 连接到 WSL
  4. 选择您的发行版,例如 Ubuntu-22.04

现在,如果您尝试使用 WSL 命令 code . ,它应该可以工作。

在我看来,这似乎是 WSL 中的网络问题。通过执行上述步骤,vscode 从 Windows 端而不是从之前失败的 WSL 内部进行更新。

  1. Open VS Code from Windows
  2. Open command palette Ctrl + Shift + p
  3. Type WSL and select option WSL: connect to WSL using Distro
  4. Select your distro, for example Ubuntu-22.04

Now if you try command code . from WSL it should work.

This seems to me a network issue in WSL. By doing the above steps, the vscode gets updated from the windows side instead from inside WSL which was failing previously.

入怼 2025-01-17 22:58:56

wget:无法解析主机地址“az764295.vo.msecnd.net”
试试这个:

sudo nano /etc/resolv.conf

将名称服务器编辑为 8.8.8.8:

nameserver 8.8.8.8

wget: unable to resolve host address ‘az764295.vo.msecnd.net’
try this :

sudo nano /etc/resolv.conf

edit name server to 8.8.8.8:

nameserver 8.8.8.8
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文