13

I'm getting this error while running node in my VS Code terminal besides I tried to run the same thing in CMD and it worked there but not in VS Code terminal: enter image description here

node: The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1
+ node
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Klaycon
  • 10,599
  • 18
  • 35
SujeetYT
  • 131
  • 1
  • 2
  • 6
  • 2
    add node to your PATH and restart VSC – Klaycon Jan 29 '20 at 23:17
  • 4
    Does this answer your question? [The term 'node' is not recognized... In Powershell](https://stackoverflow.com/questions/30318628/the-term-node-is-not-recognized-in-powershell) – Cully Jan 29 '20 at 23:19

7 Answers7

22

Try closing and then reopening VS Code.

If you have installed node while VS Code was opened then the change to the PATH won't be visible yet. (be sure that the add to PATH option is selected while installing node...if not be sure to add it to the PATH)

JoJo
  • 323
  • 2
  • 4
  • 2
    This helped me too, thanks. I had multiple Visual Studio Code windows open, I needed to close all of them. – kas May 08 '21 at 21:53
22

What worked for me was : open Visual Studio Code -> Terminal -> New Terminal

Everything else I tried didn't...

LAM Wai-Him
  • 221
  • 2
  • 2
21

I also got this error, I resolved it by opening Visual Studio Code with Run as administrator privilages (in Windows).

Demo

itsHarshad
  • 1,519
  • 14
  • 16
Asela Sampath
  • 364
  • 2
  • 6
  • Thanks !!! after all the possible solutions! This solution worked! I don't know why vscode needs admin priveleges, as it worked fine earlier without it. – Parth Developer Jan 31 '21 at 14:23
  • Thanks. This solution works. However, I wonder why this happens? I have not been able to find an answer. – Ivan Oct 22 '21 at 21:32
2

if you have anaconda installed, everytime vscode the terminal, infact the vscode opens the conda environment,

you can solve it by typing,

conda install -c conda-forge nodejs

Hb.ZHANG
  • 21
  • 1
  • That's a huge help bro. You are the hero here. Thanks a lot. – JuBaer AD Aug 27 '22 at 19:16
  • btw, you can turn this feature of vs code of enabling conda environment automatically by entering "conda config --set auto_activate_base False" from https://stackoverflow.com/a/64684533/10145774 – JuBaer AD Aug 27 '22 at 19:21
1

I faced the same error. And the solution I found is while reinstalling on the last step it asked if we wanted to install Choclatey and other few files that may be required, I unticked that option and Whola it worked. I dont know the technicality why it worked but it worked.

  • 1
    People pick on other people for spelling all the time on the internet, and I want you to make sure you know that's not what's happening here … it completely *made my day* to read that you type that as "whola." Just for future reference, if you really want to know, it's spelled … voilà. Absolutely beautiful. I loved it. Never change. ❤️ – ELLIOTTCABLE Nov 23 '21 at 21:42
  • + Your tip resolved the issue, except when it asked me to press any key to install Choclatey,... I closed the window. It really deserved a Whola – Daniel B Oct 22 '22 at 15:16
  • English isn't my first language . Nevertheless voilà I hope you understood the message I was trying to convey. Hehehe.. – Zenish Prajapati Oct 24 '22 at 07:09
0

I faced the same problem, it's because I select an option to install chocolatey and python during installation process . When I try to uninstall my node installed and try to reinstall without choosing option to install chocolatey and python it works for me .... enter image description here

Mathi
  • 1
  • 2
0

Add node to your environment variable using following steps. If your operating system is windows 10, Right click "This PC" -> Properties Properties

Then click "Advance system settings" and click "Environment Variable" button as follow

Environment variable

Then select the path and click Edit button User Variables for Administrator

For the above error you have to add node js location. Click New and add node file path. C:\Program Files\nodejs

File path