If you have node / nvm installed in Windows and then run WSL ... you may end up running Node or NVM from Windows.
To fix this ... remove Windows PATH folders from your WSL environment by ...
-
Confirming that you have Windows paths in WSL
$ echo $PATH | tr : '\n'
- Inside WSL ... create a
/etc/wsl.conffile containing ...
[interop]
enabled=false # enable launch of Windows binaries; default is true
appendWindowsPath=false # append Windows path to $PATH variable; default is true
-
Open Regedit at
HKCU\Software\Microsoft\Windows\CurrentVersion\Lxsswhere you'll see a GUI key for each WSL Linux distro -
Update
<distro>/Flagsvalue from 0x07 => 0x05 (WSL1) - check the initial value carefully -
Update
<distro>/Flagsvalue from 0x15 => 0x13 (WSL2) - check the initial value carefully -
Restart the
lxssmanagerservice -
Restart WSL and confirm that your PATH is now free of Windows paths:
$ echo $PATH | tr : '\n'