Cannot open Visual Studio Code
Solution 1:
I had the same problem described here, new install of Ubuntu 18.04 LTS. I installed VS Code from conda.
Discovered that if you run the following
code --verbose
It will tell you what is going on with Code. In my case
code --verbose
[main 20:19:26] Startup error:
Error: EACCES: permission denied, mkdir '/home/<user>/.config/Code/CachedData'
sure enough the folder ~/.config/Code had root access permissions for some reason. Deleted the folder using sudo.
rm -rf /home/<user>/.config/Code
Tried again to run code and it working fine.
Solution 2:
I had the same problem. Like Robin G and Nezir suggested I realized that the owner of the /home/user/.config/Code driectory is the "root". However, You could just change the ownership of that directory instead of removing it.
sudo chown -R user /home/user/.config/Code
"-R" option is needed to recursively change the ownership of all the files and directories under the target directory.
After this the Visual Studio Code v. 1.27 on ubuntu 18.04 works as it is supposed to on my machine.
Solution 3:
Debug the bash with the correct command
To debug you should use following command:
bash --debugger `which code`
This will run the bash script line per line. To go to the next line simply type n and return. Post the output than we will see more.
Installing via snap (for Ubuntu versions > 18.04)
BTW Ubuntu 18.04 LTS (Long term release) now supports code directly and you can install it via snap package:
Show version and info of ubuntu supported snap:
snap info code
and to install it
sudo snap install code
I personal prefer to install it via apt. Therefore follow this instruction from microsoft:
Installing VS Code
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
This will download the gpg key and copy and make the apt files. Then you can simply update and install vs code:
sudo apt-get update
sudo apt-get install code
- The advantage of this installation method is that you can simple update vscode using the apt-get update command. Works fine and I use vs code with the vim plugin for over 2 years (c, c++, python, md, latex, html, javascript ...).
Solution 4:
I had the similar problem here:
https://github.com/Microsoft/vscode/issues/55774#issuecomment-412774473
and fixed it with "delete the /home/user/.config/Code folder
"
Thank you!