我无法在 Linux 的 Win 子系统代码中为 Visual Studio 创建文件或目录

I am unable make file or directory in Visual Studio Code in Win Subsystem for Linux

我用这个guide。当我执行“添加源代码文件”步骤时,我看到了这份报告:

Unable to write file 'vscode-remote://wsl+ubuntu-20.04/home/alex/TEST/helloworld/helloworld' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/alex/TEST/helloworld/helloworld')

我不知道该怎么办,有人能帮帮我吗?

VScode 因此需要权限

在您的 WSL 终端上尝试此命令

sudo chown -R username /path/to/working/directory

替换:

'username' 加上您的用户名和目录路径