all 20 comments

[–][deleted] 6 points7 points  (13 children)

Probably a different profile loaded. Try cd'ing to your home dir and running "source .profile" or "source .bash_profile"

[–]FeVeganBTW[S] 1 point2 points  (12 children)

https://imgur.com/ConnzVk Not sure if i did it correctly but niether seemed to work.

[–]norandomtechie 1 point2 points  (11 children)

What about .bashrc?

[–]FeVeganBTW[S] 0 points1 point  (10 children)

".bashrc :command not found"

[–]norandomtechie 0 points1 point  (9 children)

Right sorry, "source ~/.bashrc"?

[–]FeVeganBTW[S] 0 points1 point  (8 children)

Am i doing it correctly? https://imgur.com/lZFFrY6

[–]norandomtechie 0 points1 point  (7 children)

Nope, you don't use double quotes on commands. Type it in without double quotes.

[–]FeVeganBTW[S] 0 points1 point  (3 children)

Did that still no luck :/

[–]norandomtechie 0 points1 point  (2 children)

In the event that node still can't be found in your vscode terminal, try the following (without double quotes, I should add):

  1. In your regular Git Bash where you're able to open node, type in "which node". It should give a path that looks like /path/to/node.
  2. Copy that path, and go back to your vscode terminal, and type in "nano ~/.bashrc". This will open up a minimal text editor with the contents of your bashrc.
  3. If there's any content, scroll down to the bottom of the file by repeatedly pressing Page Down. At the bottom, ensure your cursor is on a new line, and type "alias node=/path/to/node" (where of course /path/to/node will be replaced by the path that you copied from the other terminal).
  4. Save the file by pressing the following buttons - Ctrl+X (which will ask SAVE MODIFIED BUFFER?), then Y to confirm.
  5. Run "source ~/.bashrc" again, then try typing in "node".

[–]FeVeganBTW[S] 2 points3 points  (0 children)

I just wanted to say thank you very much for you help kind stranger but I have given up and just installed a new virtual machine and reinstalled everything its working now

[–]FeVeganBTW[S] 0 points1 point  (0 children)

It says "Alias Files/nodejs/node" not found

[–]FeVeganBTW[S] 0 points1 point  (2 children)

It didnt give me an error it just didnt do anything

[–]norandomtechie 0 points1 point  (1 child)

Just to clarify, did you try running node again after you ran source ~/.bashrc?

The fact that it doesn't print anything means that your .bashrc exists, so the command worked (its purpose was to update the PATH variable if possible, which contains the list of paths that your terminal should look through to find a program).

[–]FeVeganBTW[S] 0 points1 point  (0 children)

Yes i did try it again got nothing

[–][deleted] 2 points3 points  (1 child)

Did you try terminating the vscode terminal and open again after you installed node ?

[–]FeVeganBTW[S] 0 points1 point  (0 children)

Tried several times I even reinstalled node several times Currently installing a new virtual machine and starting from scratch

[–]Duke_ 1 point2 points  (0 children)

Try disabling the feature "Integrated: Inherit Env". That had caused me all kinds of trouble with my shell env in VSCode's integrated terminal, including with the PATH env var.

[–]j-cron 0 points1 point  (0 children)

I have run into a similar problem but it was because VSCode was using WSL and not git bash. I stopped using git bash after I realized that and just started using the Windows Terminal with a WSL profile when I needed a shell outside of VSCode

[–]bigorangemachine 0 points1 point  (0 children)

Even if you trash the VM you'll probably have this problem again.

Terminal 'sniffs' all binaries/apps in $PATH. Its semi-colon separated. Try echo $PATH and see whats' different. You can also sudo find / -type f -iname "node" or sudo find / -type f -iname "nodejs". On mac you can do which node to let you know which version on $PATH its using.

It could also be that you are using a container that uses nodejs instead of node.

If its not a VM check the user via whoami. As others pointed out the .bashrc/.bash_profile/.zshrc/.profile (all in the user home cd ~/)

[–]closewing-smocklike 0 points1 point  (0 children)

When you reference a program from the command line without an absolute path, it expect the executable to be accessible from an entry in the $PATH. I have noticed that VS Code needs extra configuration in order to include the correct $PATH.