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

本文介绍了在Linux中,由于安全原因不建议以root权限启动VisualStudioCode。提供了在root目录下修改.bashrc文件,添加alias命令以使用--no-sandbox和--user-data-dir参数的解决方案,确保了代码的安全性并使VSCode能正常启动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 #再次启动
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值