[英]Running VSCode from Ubuntu WSL2 not working
I am trying to run VSCode in my Ubuntu WSL2.我正在尝试在我的 Ubuntu WSL2 中运行 VSCode。
When I run code.
当我运行code.
, zsh is unable to find VSCode. , zsh 无法找到 VSCode。 I have installed Remote - WSL plugin in VSCode, and I am able to open my Ubuntu Instance from Windows. I want to achieve it from Ubuntu terminal as well.我已经在 VSCode 中安装了Remote - WSL插件,我可以从 Windows 打开我的 Ubuntu 实例。我也想从 Ubuntu 终端实现它。
ayman@DESKTOP ~ code .
zsh: command not found: code
I have tried wsl --shutdown
and then reinstalling Remote-WSL plugin, but it still does not work.我试过wsl --shutdown
然后重新安装 Remote-WSL 插件,但它仍然不起作用。
Is there a zsh
configuration required for running VSCode from terminal?从终端运行 VSCode 是否需要zsh
配置? If so, what are the configurations required?如果是这样,需要什么配置?
If VSCode is in your Windows path, it should be in your WSL path as well.如果 VSCode 在您的 Windows 路径中,它也应该在您的 WSL 路径中。 Things to check:要检查的事情:
Is VSCode in your Windows path? VSCode 在你的 Windows 路径中吗? If not, add it there first.如果没有,请先将其添加到那里。
Windows path propagation to WSL is enabled by default, but double-check that. Windows 默认启用到 WSL 的路径传播,但请仔细检查。 Check to see if there's a line there in the [interop]
section named appendWindowsPath
.检查[interop]
部分中是否有一行名为appendWindowsPath
。 If it is set to false
, change it to true
or just delete the line altogether.如果它设置为false
,将其更改为true
或完全删除该行。
Perhaps your startup scripts (eg ~/.zshrc
) are modifying the path (or setting a new one entirely)?也许您的启动脚本(例如~/.zshrc
)正在修改路径(或完全设置一个新路径)? If so, append to the path in your startup scripts rather than replacing it.如果是这样,请将 append 添加到启动脚本中的路径,而不是替换它。
Any zsh extensions that could be modifying the path?任何可能修改路径的 zsh 扩展?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.