4

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.

0

Depending on your Windows build number, this may or may not be normal.

During the WSL launch event, the presenter stated that at that time, WSL could not launch Windows apps and Windows couldn't launch Linux apps. That includes build number 14393.x. (Windows 10 with Anniversary Update)

This issue is later noted on the WSL GitHub site.

On 25 October 2016, it was reported that the Windows <-> WSL interoperability was added in build #14951. So, if you don't want to use a beta build of Windows 10, you'll have to wait until Creators Update is released.

Update: OP has also discovered a workaround: cbwin

  • Ok thanks! So in a nutshell, I can either get Windows Insider Program updates or wait for an official release ? Also, there seems to be this work around. – SGouws Mar 7 '17 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.