[英]Command 'code' is not available in 'snap/bin/code'
I am new to Ubuntu and I am using xfce desktop environment.我是 Ubuntu 的新手,我正在使用 xfce 桌面环境。 I was using this vscode docs to install vscode in ubuntu.我正在使用此vscode 文档在 ubuntu 中安装 vscode。 I ran this command:我运行了这个命令:
sudo snap install --classic code # or code-insiders
which executed successfully.哪个成功执行。 The documentation does not say how to open VSCODE.文档没有说明如何打开 VSCODE。 I am assuming there is no way to open it using GUI as VS Code did not appear when I tried to search for it using the search application feature?我假设没有办法使用 GUI 打开它,因为当我尝试使用搜索应用程序功能搜索它时没有出现 VS Code?
I searched on stack overflow and found that I should be able to run vs code at this point by running code
in the terminal.我搜索了堆栈溢出,发现此时我应该能够通过在终端中运行code
来运行 vs 代码。
But when I do so I get:但是当我这样做时,我得到:
Command 'code' is available in '/snap/bin/code' The command could not be located because '/snap/bin' is not included in the PATH environment variable.命令“代码”在“/snap/bin/code”中可用 由于“/snap/bin”未包含在 PATH 环境变量中,因此无法定位该命令。 code: command not found代码:找不到命令
echo $PATH
gives me: echo $PATH
给了我:
/sbin:/bin:/usr/bin:/usr/local/bin
I tried to browse to snap/bin folder and open terminal there but the terminal does not open.我试图浏览到 snap/bin 文件夹并在那里打开终端,但终端没有打开。
.bashrc
(or .zshrc
) file in your home directory (for example, /home/your-user-name/.bashrc) in a text editor.在文本编辑器中打开主目录(例如 /home/your-user-name/.bashrc)中的.bashrc
(或.zshrc
)文件。export PATH="/snap/bin:$PATH"
to the last line of the file.将export PATH="/snap/bin:$PATH"
到文件的最后一行。.bashrc
/ .zshrc
file.保存.bashrc
/ .zshrc
文件。rm -f /usr/bin/code
sudo ln -s /usr/share/code/bin/code /usr/bin/code
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.