So VSCode has an annoying bug that forces people to run nvm set
before launching VSCode for it to recognise which node binary to use.
Since I am lazy I made a unity .desktop
shortcut for it which launches a small script that does exactly that!
This could be extended in the future to include the option to use other Node versions too, and launching VSCode with them with the right click options.
I hope this saves people some time :)
Happy coding!
-
copy the code.desktop file to
$HOME/.local/share/applications/
where the other unity .desktop files live. -
Make it exectuable using
sudo chmod +x $HOME/.local/share/applications/code.desktop
. -
Put the
launch_nvm_n_code
script into your$HOME/bin
or/usr/local/bin
(or somewhere on your PATH), -
and make it executable to with chmod like before.
-
Go back to your
code.desktop
file. Just double click on thecode.desktop
file to see if it works. If it does then right click the icon and 'lock to launcher'. Or just drag the file onto the launcher.
Enjoy! Should this not work, leave a comment below!