简体   繁体   English

命令“code”在“snap/bin/code”中不可用

[英]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 文件夹并在那里打开终端,但终端没有打开。

  1. Open the .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 )文件。
  2. Add export PATH="/snap/bin:$PATH" to the last line of the file.export PATH="/snap/bin:$PATH"到文件的最后一行。
  3. Save the .bashrc / .zshrc file.保存.bashrc / .zshrc文件。
  4. Restart your terminal.重启你的终端。

删除旧的符号链接并创建一个新的

rm -f /usr/bin/code
sudo ln -s /usr/share/code/bin/code /usr/bin/code

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ubuntu 18 VS Code错误Enoent:没有这样的目录,lstat'/ snap / code' - Ubuntu 18 VS Code error Enoent: no such directory, lstat'/snap/code' Dockerfile Image命令'/ bin / sh -c apt-get install -y mysqld-server'返回了非零代码:100 - Dockerfile Image The command '/bin/sh -c apt-get install -y mysqld-server' returned a non-zero code: 100 NPM 安装在 docker 容器中失败并返回“命令'/bin/sh -c npm install'返回非零代码:1” - NPM install in docker container fails and returns “The command '/bin/sh -c npm install' returned a non-zero code: 1” 命令 '/bin/sh -c apt-get update && apt-get upgrade' 返回一个非零代码:1 - The command '/bin/sh -c apt-get update && apt-get upgrade' returned a non-zero code: 1 E:子进程/ usr / bin / dpkg返回错误代码(1) - E: Sub-process /usr/bin/dpkg returned an error code (1) 如何在 VSCode 中运行 python3 代码? /bin/sh: 1: python: 未找到 - How to run python3 code in VSCode? /bin/sh: 1: python: not found 子进程/ usr / bin / dpkg返回错误代码(1)-Ubuntu - Sub-process /usr/bin/dpkg returned an error code (1)- ubuntu 终端进程“/usr/bin/zsh”以退出代码终止:14 - The terminal process "/usr/bin/zsh" terminated with exit code: 14 vscode 无法启动并出现错误:EMFILE:打开的文件太多,请观看“/snap/code” - vscode fails to start with Error: EMFILE: too many open files, watch '/snap/code' 获取mysql命令的返回码 - Get return code of the mysql command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM