2

I followed the instructions for installing vscode:

Linux

  1. Download Visual Studio Code for Linux.
  2. Make a new folder and extract VSCode-linux-x64.zip inside that folder.
  3. Double click on Code to run Visual Studio Code.

Tip: If you want to run VS Code from the terminal, create the following link substituting /path/to/vscode/Code with the absolute> path to the Code executable

sudo ln -s /path/to/vscode/Code /usr/local/bin/code

Now, you can simply type code . in any folder to start editing files in that folder.

However upon typing code . I get:

No command 'code' found, did you mean:   
Command 'cone' from package 'cone' (universe)   
Command 'tcode' from package 'emboss' (universe)   
Command 'ode' from package 'plotutils' (universe)   
Command 'cdde' from package 'cdde' (universe)   
Command 'node' from package 'node' (universe)    
Command 'node' from package 'nodejs-legacy' (universe)   
Command 'cde' from package 'cde' (universe)   
Command 'cobe' from package 'python-cobe' (universe)   

What have I done wrong?

Clicking on the Code executable works ok.

nikolai@dante:~$ ls -l /usr/local/bin/code    
lrwxrwxrwx 1 root root 12 Oct  3 17:13 /usr/local/bin/code -> /vscode/Code    
nikolai@dante:~$ echo $PATH    
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games   
3
  • Please append the outputs of ls -l /usr/local/bin/code and echo $PATH
    – Nephente
    Oct 3, 2015 at 17:40
  • @nephente done. Oct 3, 2015 at 18:53
  • Did you really unpack VSCode to /vscode/ ? Please check the path. I would also advise to put it into /opt/vscode. That's what /opt is for.
    – Nephente
    Oct 4, 2015 at 6:04

6 Answers 6

3

I used to have the same problem, I just removed the created link with:

unlink /usr/local/bin/code/Code

Then re created the link directly under "/usr/local/bin" like below

sudo ln -s /path/to/vscode/Code /usr/local/bin

Works for me, let us know if it worked ...

2

I installed code-insiders through ubuntu softwares. since it is a snap install so it was installed into /snap/bin/code-insiders . to check whether an application is installed. run

$ dpkg -l             

it gives complete list of applications which are installed in the system. look for code-insiders there. to check the installation directory of code-insiders, run

$ which code-insiders

In my case it was showing /snap/bin/code-insiders

then i linked it to /usr/bin by running the command.

$ sudo ln -s /snap/bin/code-insiders /usr/bin

and then all done. then i could run code from terminal by using

$ code-insiders .
0

Is the path /vscode/Code corret or did you mean ~/vscode/Code? Check the link you created...

Or if you prefer you can install VSCode with this script

curl -L https://go.microsoft.com/fwlink/?LinkID=620884 > /tmp/vscode.zip
unzip -qq /tmp/vscode.zip -d /tmp
sudo cp -r /tmp/VSCode-linux-x64 /opt/vscode
sudo ln -s /opt/vscode/Code /usr/local/bin/vscode
sudo rm -rf /tmp/VSCode-linux-x64
sudo rm -f /tmp/vscode.zip
sudo touch /usr/share/applications/vscode.desktop
sudo chmod 777 /usr/share/applications/vscode.desktop
sudo echo -e "[Desktop Entry]\nName=VSCode\nComment=Visual Studio Code\nExec=/opt/vscode/Code\nIcon=/opt/vscode/resources/app/vso.png\nType=Application\nVersion=1.0\nTerminal=false\nCategories=Development" > /usr/share/applications/vscode.desktop
sudo chmod 644 /usr/share/applications/vscode.desktop

I created it as vscode rather than just code. But if you want code just change this line:

sudo ln -s /opt/vscode/Code /usr/local/bin/vscode

to

sudo ln -s /opt/vscode/Code /usr/local/bin/code

And it should work.

0

I faced the same problem and the solution was to use absolute path for /path/to/vscode/Code. For example, I extracted the compressed file in my home directory and renamed it to VSCode and run following command to make the symlink.

$ sudo ln -s /home/lekhnath/VSCode/code /usr/local/bin

where lekhnath is my username.

And it worked!!

0

I used to have the same problem and I solved it installing vscode again using

sudo apt install code

Now it works

1
0

Typing wsl --shutdown and then running code . in the newly opened Linux Distro should make it work for you if other answers didn't help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .