簡體   English   中英

運行“代碼”。 在 wsl 的終端中產生錯誤

[英]Running 'code .' in terminal in wsl produces an error

我最近安裝了 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 代碼

我設法找到了一個有點正統的解決方案

  1. 首先通過windows在本地打開Vscode
  2. 轉到上部的查看並選擇“命令面板”
  3. 選擇選項“遠程 WSL:新 WSL 窗口”

我有完全相同的問題。

Solution: 1> go to search bar and type (Turn windows features on or off) scroll down to windows subsystem for linux and uncheck it. 2> 重新啟動 3> go 回到(打開或關閉 windows 功能)#也可以位於控制面板中。 並重新選中 Windows 子系統的框 linux 4>重新啟動

現在您可以打開命令提示符並鍵入:

wsl -l -v #這將驗證您正在運行的版本。 我的在 wsl 2 上保持不變。如果不是,您可以更改它。 wsl --set-version Ubuntu20.04 2

5> 打開您的 ubuntu 命令行並嘗試重新輸入(代碼。)它應該安裝正確的包。

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. 

在此之后,一切都再次為我工作。 回顧一下,為 linux 功能禁用並重新啟用 windows 子系統。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM