找回密码
 注册
查看: 177|回复: 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.
  \% U* h3 {. F3 Z7 l) A
' w- D: }+ ?- j1 U
+ t3 Q- ]+ j# v( e* p( A5 K0 Q' Y' Z. R- O
解决办法:% k7 M8 o9 e3 h/ J

. U4 e! Y9 c8 P设置永久别名 (Alias)
! H% A1 L4 e* B  R为了方便使用,可以在 ~/.bashrc 或 ~/.zshrc 中添加别名:0 H9 e/ c, i$ ^( j
执行 vim ~/.bashrc。
' s2 o) ~0 I# o3 a& }在末尾添加:
, n9 x1 m. W% J( ]! `) H; a# [( M$ X
alias code='/usr/bin/code --user-data-dir=~/.vscode-root --no-sandbox'2 s" l4 v( X7 ^% f4 P

" N% `+ C7 X0 e3 }7 \2 N3 k; m1 i2 P1 S& h8 k2 o6 U
保存并退出,运行 source ~/.bashrc 生效。之后只需输入 sucode 即可启动。
; O7 t- [8 c' S2 C; KStack Overflow
4 l, N0 C( D, a) z# d; o1 f' |9 BStack Overflow
& o4 j4 _- w( Z2 k
, S' J" S* `* T: b% t
! U1 t( ?7 y' k) I5 [: r. w再次执行即可使用了。& d+ O9 |- t; @  p; ~) F! M

! A$ T1 I9 v; {
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-11 23:33 , Processed in 0.015470 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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