Visual Studio Code 不适用于 WSL2 [英] Visual Studio Code is not working on WSL2

查看:45
本文介绍了Visual Studio Code 不适用于 WSL2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在 WSL2 终端中打开 VS Code 时,如下所示:

 代码.

我收到以下错误:

mkdir: 无法创建目录 {DIRECTORY} : 权限被拒绝

从 sudo 开始时:

sudo: code: command not found

我在 Windows 的 PATH 中添加了 VS Code,并安装了

另外,最好把命令路径放到/etc/profile,这样每个用户都可以运行VS code.

When I try open VS Code in WSL2 Terminal, like this:

code . 

I get the following error:

mkdir: cannot create directory {DIRECTORY} : Permission denied

When started with sudo:

sudo: code: command not found

I added VS Code to my PATH on Windows, and installed WSL-Remote

I am working on:

  • Windows 10 Pro 10.0.19041
  • WSL 2
  • Ubuntu 20.04 LTS
  • VS Code 1.47.1

解决方案

Check the configure file(/etc/sudoers), you need to modify the secure_path to enable run VS code with sudo command.

Also, it is better if you put the command path into /etc/profile, so every user could run VS code.

这篇关于Visual Studio Code 不适用于 WSL2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆