Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I use this guide. When I take the step "Add a source code file", I am shown this report:

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')

I don't know what to do, can some one help me?

like image 776
Alex Removcik Avatar asked Sep 30 '20 17:09

Alex Removcik


People also ask

How do I enable VS Code in WSL?

From VS Code Start VS Code. Press F1, select Remote-WSL: New Window for the default distro or Remote-WSL: New Window using Distro for a specific distro. Use the File menu to open your folder.

How do I add or code to PATH WSL?

Visit the VS Code install page and select the 32 or 64 bit installer. Install Visual Studio Code on Windows (not in your WSL file system). When prompted to Select Additional Tasks during installation, be sure to check the Add to PATH option so you can easily open a folder in WSL using the code command.

How do I add a directory to a VS Code?

The File > Add Folder to Workspace command brings up an Open Folder dialog to select the new folder. Once a root folder is added, the Explorer will show the new folder as a root in the File Explorer. You can right-click on any of the root folders and use the context menu to add or remove folders.

How do I know if Windows subsystem is enabled Linux?

Windows Features dialog# In the Windows search bar, type 'features' to bring up the Turn Windows Features on and off dialog. Scroll down and check Windows Subsystem for Linux. Select OK and you will be prompted to restart Windows.


Video Answer


1 Answers

The VScode needs permissions thus

Try this command on your WSL terminal

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

Replace :

'username' with your username and the path of your directory

like image 163
Uday Pratap Singh Avatar answered Oct 21 '22 21:10

Uday Pratap Singh