简体   繁体   English

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

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

I recently installed wsl and running code.我最近安装了 wsl 并运行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我需要知道如何解决它才能打开 Visual Studio 代码

I managed to find a somewhat orthodox solution我设法找到了一个有点正统的解决方案

  1. First Open Vscode locally via windows首先通过windows在本地打开Vscode
  2. Go to View in upper section and select "command palette"转到上部的查看并选择“命令面板”
  3. Select the option "Remote-WSL: New WSL Window "选择选项“远程 WSL:新 WSL 窗口”

I had the exact same issue.我有完全相同的问题。

Solution: 1> go to search bar and type (Turn windows features on or off) scroll down to windows subsystem for linux and uncheck it. 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> restart 3> go back to (Turn windows features on or off) #which can also be located in the control panel. 2> 重新启动 3> go 回到(打开或关闭 windows 功能)#也可以位于控制面板中。 and recheck the box for Windows Subsystem for linux 4>restart并重新选中 Windows 子系统的框 linux 4>重新启动

now you can open to command prompt and type:现在您可以打开命令提示符并键入:

wsl -l -v #this will verify which version you are running. wsl -l -v #这将验证您正在运行的版本。 mine remained the same at wsl 2. if it is not you can change it.我的在 wsl 2 上保持不变。如果不是,您可以更改它。 wsl --set-version Ubuntu20.04 2 wsl --set-version Ubuntu20.04 2

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

Following this everything was working for me again.在此之后,一切都再次为我工作。 Recap just disable and re-enable the windows subsystem for linux feature.回顾一下,为 linux 功能禁用并重新启用 windows 子系统。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Windows 中从 ubuntu wsl 运行 pyspark,错误:找不到 cmd - pyspark running from ubuntu wsl in windows, error: cmd not found OpenCV C ++代码在终端运行良好但从eclipse运行时出错 - Ubuntu 12.04 - OpenCV C++ code runs fine in terminal but error in running from eclipse - Ubuntu 12.04 我的 WSL 终端失去了颜色 - My WSL terminal lost color 超级终端命令不适用于 WSL 2 - Hyper Terminal commands not working on WSL 2 如何将 Bash on Ubuntu on Windows (WSL) 用于我的 VS Code 终端? - How do I use Bash on Ubuntu on Windows (WSL) for my VS Code terminal? 在 WSL 上安装和运行 Airflow - Installing and running Airflow on WSL 在linux上运行节点(express)会产生Error:spawn EACCES - Running node (express) on linux produces Error: spawn EACCES code-server 3.6.0 webview 脚本问题,证书和终端未运行 - code-server 3.6.0 webview script issue with certificate and terminal not running 让 VS Code 在已经运行的终端(Ubuntu)中执行 python 脚本 - Make VS Code to execute python script in an already running terminal (Ubuntu) 运行 Ubuntu 18 LTS 的 WSL2 上出现 Pyperclip 错误,同时尝试访问从 windows 复制的数据 - Pyperclip error on WSL2 running Ubuntu 18 LTS while trying to access data copied from windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM