namko
namko

Reputation: 647

Command 'code' is not available in 'snap/bin/code'

I am new to Ubuntu and I am using xfce desktop environment. I was using this vscode docs to install vscode in ubuntu. I ran this command:

sudo snap install --classic code # or code-insiders 

which executed successfully. The documentation does not say how to open 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?

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.

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. code: command not found

echo $PATH gives me:

/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.

Upvotes: 4

Views: 6745

Answers (2)

Tarcísio Miranda
Tarcísio Miranda

Reputation: 131

Remove old symlink and create a new

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

Upvotes: 1

Denny Biasiolli
Denny Biasiolli

Reputation: 61

  1. Open the .bashrc (or .zshrc) file in your home directory (for example, /home/your-user-name/.bashrc) in a text editor.
  2. Add export PATH="/snap/bin:$PATH" to the last line of the file.
  3. Save the .bashrc/.zshrc file.
  4. Restart your terminal.

Upvotes: 6

Related Questions