microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.8k stars 28.74k forks source link

"A JavaScript error occurred in the main process" on ubuntu 14.04 #2199

Closed vkupar closed 8 years ago

vkupar commented 8 years ago

I have a problem. when I run visual studio code, error is running:

Uncaught Exception: Error: EACCES: permission denied, mkdir '/home/lingwing/.config/Code/User' at Error (native) at Object.fs.mkdirSync (fs.js:799:18) at Object. (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/workbench/electron-main/main.js:7:6141) at e._invokeFactory (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/loader.js:4:13773) at e._complete (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/loader.js:4:14012) at e.resolveDependency (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/loader.js:4:15066) at e._onModuleComplete (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/loader.js:4:21390) at e._onModuleComplete (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/loader.js:4:21434) at e._onModuleComplete (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/loader.js:4:21434) at e._resolve (/home/lingwing/Desktop/visual-studio-code/resources/app/out/vs/loader.js:4:26292) screenshot from 2016-01-23 12 34 13

bpasero commented 8 years ago

@vatex any chance that you are running code with less permissions compared to your user level permissions?

vkupar commented 8 years ago

@bpasero I don't know. I set up ubuntu yesterday. I'm logged in as root and I don't know permissions. can you give me suggestion how to run VSC?

bpasero commented 8 years ago

@vatex are you able to write into the /home/lingwing/ directory from a prompt?

vkupar commented 8 years ago

@bpasero now I have installed in /home/user/Desktop/VSCode here. ok I will try but I don't trust to it helps :/

vkupar commented 8 years ago

@bpasero I tried what you suggest me but it doesn't work :(

bpasero commented 8 years ago

@vatex I think that vscode does not have permissions to write to the home directory so I asked if you can create a file in the home directory:

vkupar commented 8 years ago

screenshot from 2016-01-23 14 16 13

vkupar commented 8 years ago

now I write sudo touch test.txt and it works.

bpasero commented 8 years ago

@vatex yeah sorry, the "~" was too much, what happens when you just "touch test.txt" without being sudo?

vkupar commented 8 years ago

@bpasero
touch: cannot touch ‘test.txt’: Permission denied

and how can I give permission to visual studio code?

bpasero commented 8 years ago

@vatex so this indicates to me that your home directory cannot be changed without root permissions but code itself is started with user permissions and then fails. There are two solutions:

vkupar commented 8 years ago

second solution tried and doesn't work and I will try first and then write here my result

vkupar commented 8 years ago

@bpasero now I don't have problem in opening but now program doesn't work. I captured video and you can saw. out.ogv.zip

bgse commented 8 years ago

@vatex If operating in your home directory needs root permissions, then something is wrong there, it should belong to the respective user account.

That is the first problem we need to fix here, sudo-ing commands because of wrong permissions are likely to mess things up even more at this point.

What does the command line say when you do this:

ls -la /home

vkupar commented 8 years ago

@bgse total 12 drwxrwxr-x 3 root root 4096 Jan 22 16:50 . drwxr-xr-x 23 root root 4096 Jan 22 12:02 .. drwxr-xr-x 39 user user 4096 Jan 23 15:39 user

bgse commented 8 years ago

@vatex Okay, looks like the directory itself has the proper permissions. What do the following commands say:

ls -la /home/lingwing

whoami

vkupar commented 8 years ago

@bgse ls -la /home/user >> here is a big list whoami >> (user)

bgse commented 8 years ago

@vatex In that big list, does it show that the ".config" directory is owned by "lingwing lingwing" ?

If that is the case, then do:

ls -la ~/.config | grep Code

This should also show that these directories are owned by your user.

vkupar commented 8 years ago

@bgse
ls -la /home/user >> drwx------ 26 user user 4096 Jan 23 14:40 .config ls -la ~/.config | grep Code >> drwx------ 5 root root 4096 იან 22 19:54 Code

bgse commented 8 years ago

@vatex Ok, looks like we may have found the issue. The directory VSCode wants to write to is owned by root, but it should be owned by lingwing. This can be fixed by doing:

chown --recursive lingwing ~/.config/Code

vkupar commented 8 years ago

@bgse thank you. it works!

vkupar commented 8 years ago

@bgse @bpasero extension installer doesn't work :( I seen permissions and everything is ok but why doesn't installs I don't know

bpasero commented 8 years ago

@vatex I guess now you have the same problem with Code not being able to write to ~/.vscode/extensions. Since this is not a Code issue, I am closing this one.