I have everything installed, the program launches as it should. But when I click on File –> New File nothing happens, the window stays responsive, then Visual Studio Code closes on its own.
The command I run to get it to launch is:
sudo /usr/local/VisualStudio/VS/Code
EDIT
As @Jonno stated below, it may be a perms issue. If I run
ls -la /usr/local/VisualStudio/VS
this is returned
-rwxr-xr-x 1 root root 6440496 Dec 19 11:36 /usr/local/VisualStudio/VS/Code
Granting my user rw acces to the folder now throws a JavaScript error when I attempt to launch the program. Below is the error:
Uncaught Exception: Error: EACCES: permission denied, mkdir
'/home/owner/.config/Code/User'
at Error (native)
at Object.fs.mkdirSync (fs.js:799:18)
at Object. (/usr/local/VisualStudio/VS/resources/app/out/vs/workbench/electron-main/main.js:7:6141)
at e._invokeFactory (/usr/local/VisualStudio/VS/resources/app/out/vs/loader.js:4:13773)
at e._complete (/usr/local/VisualStudio/VS/resources/app/out/vs/loader.js:4:14012)
at e.resolveDependency (/usr/local/VisualStudio/VS/resources/app/out/vs/loader.js:4:15066)
at e._onModuleComplete (/usr/local/VisualStudio/VS/resources/app/out/vs/loader.js:4:21390)
at e._onModuleComplete (/usr/local/VisualStudio/VS/resources/app/out/vs/loader.js:4:21434)
at e._onModuleComplete (/usr/local/VisualStudio/VS/resources/app/out/vs/loader.js:4:21434)
at e._resolve (/usr/local/VisualStudio/VS/resources/app/out/vs/loader.js:4:26292)
A follow-up to the above error, in terminal when I attempt to run this, I get an error of
Home Directory not accessible: Permission Denied
Running the commands suggested in comments by @Daniel B It presents this:
owner@HP-Backup:~$ stat $HOME $HOME/.config $HOME/.config/Code $HOME/.config/Code/User
File: ‘/home/owner’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fc00h/64512d Inode: 2097154 Links: 21
Access: (0711/drwx--x--x) Uid: ( 1000/ owner) Gid: ( 1000/ owner)
Access: 2016-01-16 11:50:57.611516775 -0500
Modify: 2016-01-16 15:51:28.718168518 -0500
Change: 2016-01-16 15:51:28.718168518 -0500
Birth: -
File: ‘/home/owner/.config’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fc00h/64512d Inode: 2097169 Links: 17
Access: (0710/drwx--x---) Uid: ( 1000/ owner) Gid: ( 1000/ owner)
Access: 2016-01-16 11:50:57.611516775 -0500
Modify: 2016-01-16 00:05:47.032952468 -0500
Change: 2016-01-16 11:50:57.611516775 -0500
Birth: -
File: ‘/home/owner/.config/Code’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fc00h/64512d Inode: 2098587 Links: 4
Access: (0700/drwx------) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2016-01-16 00:05:47.032952468 -0500
Modify: 2016-01-16 00:10:55.755334025 -0500
Change: 2016-01-16 00:10:55.755334025 -0500
Birth: -
stat: cannot stat ‘/home/owner/.config/Code/User’: Permission denied
owner@HP-Backup:~$
Best Answer
Because you mistakenly started the application as root, its settings folder in your user profile is now owned by root. There are two ways to fix this:
sudo rm $HOME/.config/Code
sudo chown -R owner:owner $HOME/.config/Code
Never run a program using as root unless you’re going to make system changes. An IDE is not something that needs to run as root.
If you decide to install VS Code in
/opt
(where it arguably belongs) or any other “global” location, make sure to use the proper umask, so regular users can read and execute files afterwards: