首页 > 解决方案 > 每当我重新启动 Visual Studio Code 时,远程 - WSL 扩展都会给我警告消息

问题描述

  1. 我在 WSL2 上安装了带有 Node.JS 14.16.0 的 Visual Studio Code(版本 1.59.0)(从 WSL1 更新)

  2. 每次我启动 Visual Studio Code 时,远程 - WSL(扩展)都会发出警告“您当前正在使用 WSL 1。我们强烈建议升级到 WSL 2 以提高性能。”

  3. 阅读更多按钮只是将我重定向到 Microsoft 的比较 WSL 1 和 WSL 2 页面。“https://docs.microsoft.com/en-us/windows/wsl/compare-versions”

  4. 但我已经将 WSL 升级到 WSL2(内核 5.10.16)

  5. 我还从 Windows PowerShell 运行了“wsl --set-default-version 2”,它工作正常。

  6. 尝试卸载并重新安装 Remote - Visual Studio Code 的 WSL 扩展,但失败。

这有什么问题?

标签: visual-studio-codewindows-subsystem-for-linuxwsl-2

解决方案


打开powershell并运行命令:

wsl --set-version <your distro name here> 2

提示会向您返回一条消息,例如“转换此任务可能需要请假时间”。

然后在 WSL 上打开 VSCode。


推荐阅读