1

I have Ubuntu LTS 20.04 running on wsl2 in Windows, this way I'm able to compile my JS/React code and run my php server in linux and use windows to code using Visual Studio Code.

This is running great, but a strange thing is happening, I installed nvm and gulp through the Visual Studio Code terminal and if I use them on the terminal it works fine but not if I do it outside the terminal (using Windows terminal), it says not found for both gulp and nvm.

I assume VSCode is adding a few things to the PATH but I don't know what to do for them to be found by the windows terminal (outisde VSCode terminal). Screen below. On the left is the result of running nvm list inside VS Code terminal and on the right on Ubuntu terminal, which can't find.

enter image description here

out_sid3r
  • 1,018
  • 2
  • 20
  • 42
  • Is the terminal in your VS Code CMD, PowerShell, Bash or something different? – MindSwipe Mar 02 '21 at 09:15
  • I would say Bash, I mean, I'm using WSL , I run "code" on the ubuntu 20 terminal to open the VS Code on the linux folder with the code and then open the terminal – out_sid3r Mar 02 '21 at 11:19
  • Could you verify? There is a little text box with a number, a colon, and the name of the shell. Should look something like this https://i.imgur.com/PJlbE9d.png – MindSwipe Mar 04 '21 at 07:17
  • Yap, it's bash: https://imgur.com/n5dYYZW – out_sid3r Mar 04 '21 at 11:19
  • 1
    Ok, then in both you can do `echo $PATH` and see if the path is different, if it is the easiest solution would be to add the missing items to your $PATH variable in WSL (more on how to do it [here](https://stackoverflow.com/a/26962251/9363973)) – MindSwipe Mar 04 '21 at 14:40
  • In both cases you're in the same directory? And what exactly did you do for "I installed nvm and gulp"? – henry Mar 04 '21 at 19:10
  • Can you include images of the vscode bottom toolbar and the entire windows terminal application? – joshua Mar 06 '21 at 04:40
  • Did you try finding the `nvm` executable and adding it to your PATH? Once you resolve your `nvm` issue the `gulp` issue should resolve - as long as you installed it in the `nvm` advised way, which is by adding it to some configuration file of what `nvm` should install upon changing node versions. – Slbox Mar 08 '21 at 23:07
  • Your question and the attached screenshots seem incomplete. Please upload the correct information so the community does not have to go back and forth on the question. – Ashish Santikari Mar 09 '21 at 08:57

2 Answers2

0

I'm a bit confused by your question. It sounds like you're installing programs on Windows through the VSCode terminal, and then trying to run them on Windows but it's not working. But then your screenshot shows the WSL Ubuntu prompt failing to find the command. Assuming you want to run these under WSL, log in to WSL Ubuntu and run this:

find / -name nvm

If you actually want to use the Windows terminal to run the program, you'll have to find where it is installed in Windows and make sure that's in your %PATH% but this doesn't seem like it's what you're trying to do.

rand'Chris
  • 788
  • 4
  • 17
0

The correct answer was provided by the comment from MindSwipe. On VSCODE terminal if I "echo $PATH" it has the nvm directory in it while the $PATH on WSL doesn't, I assume VSCODE alters its own terminal PATH when the tools are installed using it instead of the global WSL path.

I've changed the WSL path and it's now working, how can I present the bounty to MindSwipe ?

out_sid3r
  • 1,018
  • 2
  • 20
  • 42
  • I believe @MindSwipe needs to repost the comment as an answer, then you can accept the answer and give credit. Thanks for posting the solution in the meantime. – rand'Chris Mar 16 '21 at 20:15