new user does not recognize command `code`

I have Windows Terminal running bash in Ubuntu and had been working under root by default. I had isntalled the Remote wsl extension and successfuly opened vs code with code . on several occasions. After realizing I should be working under a new_user with root access and sudo privelages but cannot launch vs code whic is installed on my windows c drive. When I run code under new_user, I just get “Command ‘code’ not found, did you mean: …”

I can’t figure out if its a setting in a .bashrc or something under /.vscode-server

Answer

I would try to figure out the $PATH of the first user

which code
echo $PATH

switch to the second user and

PATH=$PATH:/PATHTOCODE;export PATH 

and see if that works.

Attribution
Source : Link , Question Author : Matan , Answer Author : Mark Scheck

Leave a Comment