vscode . open project

You are trying to start Visual Studio Code as a super user which isn’t recommended. If this was i…

在 centos7 中通过 wget 安装 vscode (tar.gz 格式) 后,执行 /bin/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.
您正试图以超级用户身份启动 Visual Studio 代码,这是不推荐的。如果是这样,请添加参数 “–no sandbox”,并使用 “–user data dir” 参数指定备用用户数据目录。

解决方法:
方法一:修改~/.bashrc

1
vi ~/.bashrc

添加一行

1
2
3
whereis code 
# code: /usr/bin/code /usr/share/code
alias code='/usr/share/code/code . --no-sandbox --unity-launch'
1
source ~/.bashrc