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 #再次启动
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐