1

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   
  • Please append the outputs of ls -l /usr/local/bin/code and echo $PATH – Nephente Oct 3 '15 at 17:40
  • @nephente done. – NikolaiDante Oct 3 '15 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 '15 at 6:04
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 ...

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!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.