135

I am using phonegap/cordova.

Everthing is installed propelry i.e cordova, phonegap, ant,sdk,jdk.

But now it says "node is not recogzed as an internal or external command"

11
  • 1
    Node.js is a requirement ... install it for your OS (nodejs.org) Commented May 1, 2014 at 17:27
  • 1
    i have installed node.js Commented May 1, 2014 at 17:31
  • do i have to set environment variables? Commented May 1, 2014 at 17:32
  • 1
    path variable has only nodejs's path or even ant path? Commented May 1, 2014 at 17:51
  • 1
    So, in your case got to control panel->system->advanced system settings->environment variables->system variables and add C:\Program Files\nodejs to the path variable Commented May 1, 2014 at 17:53

20 Answers 20

201

In Windows, you need to set node.js folder path into system variables or user variables.

1) open Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables

2) in "User variables" or "System variables" find variable PATH and add node.js folder path as value. Usually it is C:\Program Files\nodejs;. If variable doesn't exists, create it.

3) Restart your IDE or computer.

It is useful add also "npm" and "Git" paths as variable, separated by semicolon.

Sign up to request clarification or add additional context in comments.

2 Comments

windows 7, on start menu, right click "computer", properties, "advanced system settings", confirm admin, click "environment variables", then in "System variables" section find "PATH", edit, add semicolon and your node path the the end (without trailing slash)
for me, i missed the 3rd step.. i had VS Code opened when i was installing node JS. so it didnt detect the change in PATH.. once i restarted VS code it ran node command without any issue
142

Great answers, but you could just open the command prompt and type in

SET PATH=C:\Program Files\Nodejs;%PATH% 

6 Comments

for me the NodeJs path is C:\Program Files (x86)\nodejs
Note that this will NOT change the path variable permanently.
This doesn't seem to work entirely. I have nodejs on my path, and can run the cordova scripts successfully... but some of them (e.g. cordova platform add browser) create and run a batch file, and it seems that the path settings don't persist across to the execution of that batch file.
... although that seems to be caused by some kind of cygwin issue. Running the scripts from cmd.exe rather than from cygwin bash works fine.
Doesn't change permanently, but you can combine adding it to the system variables path and this solution so at least a reboot won't be required
|
47

Worked for me by running the command prompt as an administrator

1 Comment

OH MY GOD, IT WORKS! Other answers are assuming that I don't have the PATH variable set which is absurd because that is not the case. Even with PATH set, it still cannot find node unless I run cmd as admin. I think this is the cause: support.microsoft.com/en-us/help/821761/… Very weird because it doesn't happen every time.
16

Add a system variable named "node", with value of your node path. It solves my problem, hope it helps.

Comments

10

If you install Node using the windows installer, there is nothing you have to do. It adds path to node and npm.

You can also use Windows setx command for changing system environment variables. No reboot is required. Just logout/login. Or just open a new cmd window, if you want to see the changing there.

setx PATH "%PATH%;C:\Program Files\nodejs" 

Comments

10

Also, try to run nvm on to turn on the node. Worked for me.

3 Comments

nvm is also not recognized
God bless you my friend. This worked for me.
If you use the user non-administrator, this method is worked. 1. Run the command follow @Robert Hovhannisyan on the terminal with administrator rights 2. Switch back to non-admin user. Try to run the command to check the result
8

As you're using Windows, installation should automatically edit the %PATH% variable. Therefore, I suspect you simply need to reboot your system after installing.

3 Comments

Reboot should work, but you could also try restarting your program so they get the changed PATH.
As a windows user, this helps. Try restart after installing node js.
for me, removing the existing and reinstalling new nodejs worked
3

Be aware that the Path is case sensitive. I tried setx PATH and it didn't work. In my case it was setx Path. Make sure your CMD run as Administrator.

setx Path "%PATH%;C:\Program Files\nodejs" 

Now just restart your command prompt (or restart the PC) and the node command should be available.

Comments

2

I tried the solutions above but uninstall and reinstall of nodejs from installer the only one worked for me.

2 Comments

same for me, it was all installed and set but still didn't work.
Same for me. This is on a company VM too so not sure if there's some sort of permission or other related issue.
1

If you already have node installed, your path variable is set up and you suddenly start getting this error; try updating to the latest version.

This worked for me going from 6.9.2 to 6.10.

Comments

1

In my case, I'm using NVM and it installed Node v16.2.0, which for some reason has node.exe named as node64.exe. I changed it to node.exe and everything just worked.

Comments

0

In windows search bar type "enviroment variable" open it and set path

C:\Program Files\nodejs;

After adding path in system enviroment variable, If problem still occurs then follow steps

  • Close cmd and open new cmd, try "node" command.
  • For VS code close all windows and reopen then try "node" command.
  • If above steps didn't work then restart system.(this one worked for me)

Comments

0

Try to add the version at the end in the PATH variable

C:\Program Files\nodejs\16.x.x 

Comments

0

You can try to run on "Node.js command prompt" enter image description here

Comments

-1

In my case I was using nvm-windows and JetBrains Rider. The required paths were specified in environment variables, but MSBuild wasn't picking them up. Apparently I haven't rebooted my PC after installing NVM. Rebooting the PC fixed the problem.

Comments

-1

Please install node through nvm

following command will give you the path where node is installed .

nvm root Current Root: C:\Users\u725561\AppData\Roaming\nvm 

node would be present inside the subdirectory of nvm root .

add the directory C:\Users\u725561\AppData\Roaming\nvm\v12.22.2 to path environment variable.

Comments

-1

I had the same problem. My solution was just restart :/ If you have this problem, you should just try restart first...

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-1
 **Wnidows-11** 

control panel---Advance system setting----Enviornment Variable---new----Variable Name(Path) Varibale value(C:\Program Files\nodejs or whichever your path)

Afterwards restart your cli and node -v then boom!!

enter image description hereenter image description hereenter image description here

Comments

-1

Make sure that the node.exe exists in C:\Program Files\nodejs\, then add it to the path. ( See above answers to see how)

I am using chocolate package manger for installing nodejs by running choco install nodejs. Surprisingly in some versions the node.exe was not created in C:\Program Files\nodejs\ !

So make sure the node.exe is in C:\Program Files\nodejs\

Comments

-4

enter image description here

For me I just click on empty session and it works for me

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.