Visual Studio Code报错:You are trying to start Visual Studio Code as a super user which isn‘t......

01、具体报错

[root@localhost ~]# code
You are trying to start Visual Studio Code as a super user which isn't recommended. 
If this was intended please add the argument `--no-sandbox` and specify an alternate 
user data directory using  the `--user-data-dir` argument.

02、报错原因

不推荐以root账户启动vscode,需要添加参数

03、解决方案

[root@localhost ~]# pwd
/root #在root目录下
[root@localhost ~]# vim .bashrc

添加以下配置

alias code='/usr/share/code/code . --no-sandbox --unity-launch'

配置生效

[root@localhost ~]# source ~/.bashrc
[root@localhost ~]# source ~/.bashrc #再次启动

你可能感兴趣的:(linux,C++开发工具,IDE,vscode,ide,编辑器)