找回密码
 注册
查看: 178|回复: 0

vs code 报as a super user `--no-sandbox`解决办法

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2026-4-9 19:12:06 | 显示全部楼层 |阅读模式
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.
* L/ H) E/ |2 [3 j% h
& c: ^/ X0 g4 i$ }- |0 ]/ [& j
* {6 L3 \: R! @) `% F0 Z. K$ U5 u
解决办法:
: \- H& d4 q. \: C" I% N2 |& N, `3 B2 [; v7 E& n9 l  A7 Y8 N6 l9 W
设置永久别名 (Alias) ' A, I# p/ v$ x6 z
为了方便使用,可以在 ~/.bashrc 或 ~/.zshrc 中添加别名:
. x3 W" ~, F9 n6 N3 g7 j- |+ _执行 vim ~/.bashrc。- D# r, S  H9 J4 l- F
在末尾添加:+ m" o& D- v. }  D3 {' `7 \
# g' t0 V+ z+ X
alias code='/usr/bin/code --user-data-dir=~/.vscode-root --no-sandbox'# d* {* I8 f  _

* Y( z6 l# Q8 F, Z- R6 G! |% w- w$ c% D5 e6 V, w8 K& c
保存并退出,运行 source ~/.bashrc 生效。之后只需输入 sucode 即可启动。 % l" ^; F% J) |
Stack Overflow! x% I, {4 R0 q. L. |2 @: K: ]4 {
Stack Overflow8 R8 K6 h9 W, N4 ~& L0 X4 [

* ~1 u1 l: r$ d- y, w$ k, L5 ]8 |9 R# D$ P8 _' y/ H! L
再次执行即可使用了。& X/ G8 w$ n1 g/ M, W+ i
0 _3 y; h  O+ ^9 Q
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-11 23:38 , Processed in 0.020494 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表