123

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 Yeole
  • 4,812
  • 1
  • 21
  • 43
Meghana
  • 1,238
  • 2
  • 8
  • 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
  • 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 – 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
  • Hi I'm having this same issue. I was told to go to control panel too and then system and so on. My question is how do I get to control panel? I can't find it when I search it. – Aishah91 Jan 12 '23 at 14:34

21 Answers21

193

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
  • 2,121
  • 1
  • 10
  • 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
131

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

SET PATH=C:\Program Files\Nodejs;%PATH%
stuckoverflow
  • 625
  • 2
  • 7
  • 23
Travis
  • 1,674
  • 1
  • 9
  • 14
  • 3
    for me the NodeJs path is C:\Program Files (x86)\nodejs – Dilhan Jayathilake Oct 04 '16 at 22:35
  • 13
    Note that this will NOT change the path variable permanently. – ESP32 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
  • 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 – David Glass Dec 17 '22 at 14:15
  • Nice answer but please be noted this setting is temporary and will be invalid after reboot. For permanent solution you still have to edit the environment variable. – Allen Chen Jan 06 '23 at 01:27
44

Worked for me by running the command prompt as an administrator

Oush
  • 3,090
  • 23
  • 22
  • 4
    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
16

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

Dong
  • 434
  • 11
  • 19
11

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,425
  • 26
  • 16
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,229
  • 2
  • 23
  • 37
4

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

Robert Hovhannisyan
  • 2,938
  • 6
  • 21
  • 43
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,719
  • 1
  • 25
  • 26
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.

Erik Waters
  • 177
  • 1
  • 13
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
  • 1,023
  • 1
  • 9
  • 18
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)
GAURAV MOKASHI
  • 1,906
  • 2
  • 14
  • 17
0

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

Nick
  • 19
  • 2
0

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

C:\Program Files\nodejs\16.x.x
Bikale G
  • 67
  • 4
0
                                **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

0

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

-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.

Eternal21
  • 4,190
  • 2
  • 48
  • 63
-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.

Tanmay Patil
  • 659
  • 1
  • 4
  • 21
-1

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

hilmidemirtas
  • 40
  • 1
  • 6
  • 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
-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\

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
-1

I went through all the comments here, none of them worked. I found I had to uninstall and reinstall node.js and then it worked. Probably not the best solution but try this answer at the bottom of the list if all else fails...

arame3333
  • 9,887
  • 26
  • 122
  • 205
-4

enter image description here

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