107

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"

Harshal Y.
  • 4,475
  • 1
  • 16
  • 40
Meghana
  • 1,078
  • 2
  • 7
  • 6
  • 1
    Node.js is a requirement ... install it for your OS (nodejs.org) – mortsahl May 01 '14 at 17:27
  • i have installed node.js – Meghana May 01 '14 at 17:31
  • do i have to set environment variables? – Meghana May 01 '14 at 17:32
  • Make sure it's in your path – mortsahl May 01 '14 at 17:34
  • how to add it to my path? What are the values to be included to my path variable? – Meghana May 01 '14 at 17:39
  • That depends where you installed it. On my Windows box I have it installed at C:\Program Files\nodejs. On my OSX box it's at /usr/local/bin/node – mortsahl May 01 '14 at 17:45
  • 1
    path variable has only nodejs's path or even ant path? – Meghana May 01 '14 at 17:51
  • 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 – mortsahl May 01 '14 at 17:53
  • I was still experiencing this problem even after I installed node.js and placed all the proper variables, and I reinstalled the OS ( W 7 ) and it was solved. The hard disk becomes digitally corrupt after a while – user979431 Dec 14 '14 at 22:54
  • This is a simple problem to solve by adding the path to your environment variables https://love2dev.com/blog/node-is-not-recognized-as-an-internal-or-external-command/ I still wonder why this happens since the install application configures the environment variables for you. – Chris Love Apr 07 '18 at 16:57

16 Answers16

167

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.

webmato
  • 1,851
  • 1
  • 9
  • 6
  • 1
    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) – Jacob Brewer Jun 16 '15 at 15:00
  • 3
    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 – Abdul Hameed Oct 20 '18 at 17:00
111

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

SET PATH=C:\Program Files\Nodejs;%PATH%
stuckoverflow
  • 584
  • 2
  • 7
  • 21
Travis
  • 1,475
  • 1
  • 8
  • 11
  • 3
    for me the NodeJs path is C:\Program Files (x86)\nodejs – Dilhan Jayathilake Oct 04 '16 at 22:35
  • 7
    Note that this will NOT change the path variable permanently. – Gerfried Mar 10 '17 at 17:35
  • 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. – Jules Jun 07 '17 at 04:37
  • ... 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. – Jules Jun 07 '17 at 04:50
  • This is working thank you. – Bunthai Deng Nov 16 '21 at 08:36
36

Worked for me by running the command prompt as an administrator

Oush
  • 2,633
  • 22
  • 20
  • 2
    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: https://support.microsoft.com/en-us/help/821761/changes-that-you-make-to-environment-variables-do-not-affect-services Very weird because it doesn't happen every time. – off99555 Aug 06 '18 at 02:30
  • saved the day!! Thanks – tito.300 Feb 28 '19 at 01:13
16

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

Dong
  • 354
  • 9
  • 17
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"
hipertracker
  • 2,321
  • 24
  • 14
9

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

Jack
  • 2,049
  • 1
  • 22
  • 35
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.

ADM-IT
  • 3,017
  • 21
  • 21
3

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

Robert Hovhannisyan
  • 2,270
  • 4
  • 19
  • 32
2

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.

Erik Waters
  • 159
  • 13
1

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)
GAURAV MOKASHI
  • 1,337
  • 2
  • 12
  • 16
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.

AlphaBeta
  • 873
  • 1
  • 7
  • 16
0

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.

Eternal21
  • 3,551
  • 1
  • 42
  • 55
0

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.

Tanmay Patil
  • 631
  • 1
  • 4
  • 19
0

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

  • 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](/help/how-to-answer). – Community Feb 17 '22 at 04:40
0

enter image description here

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

Fahad
  • 51
  • 1
0

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

Nick
  • 11
  • 2