I've recently started using WSL, I've installed zsh
and done some config.
I am however unable to use npm
commands in the WSL bash window. I can happily use npm
in Git Bash Cygwin, Command Prompt, etc. But if I try the command within Bash for Ubuntu on Windows I get the following error:
$ npm init
zsh: command not found: npm
Is this a zsh
config error or how do I go about solving this?
EDIT (Fixed): I received the below feedback from a Bash on Windows Github contributor. Essentially what this means is that you must install certain runtimes(such as NodeJs) on WSL, even if they already exist on Windows, in order to use those runtimes within Bash on Windows. I've installed Node on WSL and it's working perfectly.
You should think of WSL as a light weight Linux subsystem that runs on Windows similar to a container. The runtimes on Windows and WSL should be considered independent, but with interop between the two the lines can start to blur. For example, if you have perl installed in both environments you could either run with the WinPE perl.exe or the elf64 perl.