Skip to content

Instantly share code, notes, and snippets.

@tohagan
Last active August 21, 2021 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tohagan/5da4bbf8bcc7078720636ff80ffc388f to your computer and use it in GitHub Desktop.
Save tohagan/5da4bbf8bcc7078720636ff80ffc388f to your computer and use it in GitHub Desktop.
Remove Windows paths from WSL

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'

For Windows build HIGHER than 17713 (safer option)

  • Inside WSL ... create a /etc/wsl.conf file containing ...
[interop]
enabled=false # enable launch of Windows binaries; default is true
appendWindowsPath=false # append Windows path to $PATH variable; default is true

For Windows build LOWER than 17713

  • Open Regedit at HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss where you'll see a GUI key for each WSL Linux distro

  • Update <distro>/Flags value from 0x07 => 0x05 (WSL1) - check the initial value carefully

  • Update <distro>/Flags value from 0x15 => 0x13 (WSL2) - check the initial value carefully

  • Restart the lxssmanager service

  • Restart WSL and confirm that your PATH is now free of Windows paths:

    $ echo $PATH | tr : '\n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment