I was configuring the new Windows subsystem for Linux 2 developing environment. I have installed VSCode in Windows and WSL2 distribution of Ubuntu 18.04. I can open VSCode in Ubuntu(accessed through Windows Terminal) normally when logged as normal user, using command as follows:
simp1e@ZhuXian:/mnt/c/WINDOWS/system32$ code .
But when I add sudo command in the front, the error occurs as follows:
simp1e@ZhuXian:/mnt/c/WINDOWS/system32$ sudo code .
sudo: code: command not found
At first, the problem remains after I switched to root user. Later I found that the PATH of root user didn't contain VSCode. So I add the VSCode path to /etc/environment. After that root user can open VSCode normally, but sudo code .
still have the problem.
What should I do? Is this still related to the PATH?