简体   繁体   English

如果我不以 root 身份运行 vs code,则 vs code 无法安装扩展

[英]Vs Code unable to install extension if I don't run vs code as root

In macOS, my Vs Code can't read my extensions if I don't run it as root user.在 macOS 中,如果我不以 root 用户身份运行,我的 Vs Code 将无法读取我的扩展。

It happened after I changed owner of /Applications/Visual Studio Code.app/Contents/MacOS/Electron to install an extension called 'Custom CSS and JS Loader'.它发生在我更改/Applications/Visual Studio Code.app/Contents/MacOS/Electron的所有者以安装名为“Custom CSS and JS Loader”的扩展程序之后。 I don't what is correct permission here, I don't want to reinstall Vs Code currently.我在这里没有正确的权限,我目前不想重新安装 Vs Code。

If I run如果我跑

ll /Applications/Visual\ Studio\ Code.app/Contents/MacOS

I got this output我得到了这个 output

-rwxr-xr-x 1 xyh wheel 221K Nov 13 09:01 Electron

Hope to get some help.希望能得到一些帮助。 Thanks !谢谢 !

For me, the output to that ll is:对我来说,该ll的 output 是:

-rwxr-xr-x 1 bobvork staff 221K Feb 11 06:56 Electron

I had a similar problem recently, where I installed an extension while running as root.我最近遇到了类似的问题,我在以 root 身份运行时安装了一个扩展。 I found that ~/.vscode/extensions contained a file called .obsolete that was owned by root.我发现~/.vscode/extensions包含一个名为.obsolete的文件,该文件由 root 拥有。 I just deleted the file, ran VS Code again and it was fixed.我刚刚删除了文件,再次运行 VS Code 并修复了它。

Hope this helps you (or someone else)希望这可以帮助您(或其他人)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM