13

Although I've follow suggestions from:

I'm having an strange issue: Resume, although node path is list in Path, it doesn't find node.

Workflow:

Microsoft Windows [Version 6.3.9600]    //Running CMD on windows 8.1 
(c) 2013 Microsoft Corporation. All rights reserved.

I followed suggestions in SO, adding variable to Environment Variables, and it's display Ok in Path:

C:\Users\myUser>path
PATH=c:\Program Files (x86)\nodejs ; (...omitted...) //So folder is there

Next line will fail

C:\Users\myUser>call jasmine-node spec  
'node' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\myUser>cd "c:\Program Files (x86)\nodejs" //So I move to the folder list before...

But if I move to folder list in Path, then it works OK.

c:\Program Files (x86)\nodejs>call jasmine-node spec
>  (...omitted...) //Exec OK.

c:\Program Files (x86)\nodejs>node
>   //Exec OK. Waiting...

It seems contradictory.

Community
  • 1
  • 1
Mario Levrero
  • 3,345
  • 4
  • 26
  • 57
  • 3
    Is there really a space before the semicolon in your `PATH` or did you add that while redacting? – hobbs Oct 01 '14 at 15:30
  • 1
    O_O hobbs!! That was it! I edit manually adding a whitespace! Thanks a lot! I've spent hours trying to find the problem! If you add it as an answer I'll accept it. – Mario Levrero Oct 01 '14 at 15:38
  • This happened to me **JUST AFTER** I installed a different, non related program. It might not be anything Node related that causes this problem to "suddenly" crop up. In my case, Dropbox altered my PATH. – Geek Stocks Jul 18 '17 at 14:33

14 Answers14

7

The nodejs directory in your PATH isn't recognized because there's a space before the semicolon, so Windows is looking for a directory with a space at the end of the name, which doesn't exist.

hobbs
  • 223,387
  • 19
  • 210
  • 288
5

Error: 'node' is not recognized as an internal or external command

The problem is may be the node is not installed on the machine in which the application is running.

Then install it and set the environment variable for nodejs.

Or

One more reason can be the nodejs path not set in the environment variable.

Check with the following - open Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables -> Path

the nodejs path should be available here. If not available then add the following:

C:\Program Files (x86)\nodejs OR C:\Program Files\nodejs

Now Re-Run the application and the Error got resolved.

Gurupreet
  • 189
  • 2
  • 1
3

;C:\Program Files\nodejs\

Slash after \nodejs\ worked for me

bernaulli
  • 147
  • 4
3

Usually the environment variables are not effective till a system Restart.

I suggest a System Restart for all those who face the same issue when doing a clean install.

This worked for me.

sudhansu63
  • 6,025
  • 4
  • 39
  • 52
  • 2
    On contrary, USUAL behavior is that system restart is NOT required But NEW command window has ALWAYS to be opened for the cmd to work. – nanosoft Sep 08 '16 at 06:50
2

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

If you did npm install jasmine-node -g you should just need to do jasmine-node spec (no call prefix).

mscdex
  • 104,356
  • 15
  • 192
  • 153
0

If you've checked your PATH, and are sure that the path for node is added properly, then you're likely to face the problem while running node OR npm commands with CLI's other than the default command line interface of the operating system (e.g. Git bash in Windows).

The strange part is that you can check for node -v and npm -v in those CLIs, but for some reasons, they don't work well with those commands (especially when combined with install or update).

Possible Solution

Try running node with the default terminal for your OS.

Ahmad Baktash Hayeri
  • 5,802
  • 4
  • 30
  • 43
0

I faced this issue even after adding node.exe to PATH. I wasn't able to run node command at random locations without running command prompt as administrator.

Solution to this issue is, you have to give full access permissions to this node.exe file for different user types. open the properties of node.exe, go to security tabs, check all the security options to the user on your local machine.

after doing this you should be able to access the node.exe file from any location.

Player_Neo
  • 1,413
  • 2
  • 19
  • 28
0

things to check:

open CMD>Go to the directory where node.exe resides > type node -v > :

  1. if it shows the version: Please add the same path (like> PATH=C:\Programfiles\nodejs\;) in the OS path in environment variable (any of the system or user variable, both work fine)

  2. if it doesn't recognize, please add a variable PATHEXT=.exe; in the environment variable (The PathExt is an Environment Variable that stores a list of the file extensions for the operation system to execute) and save them.

    Now open a new command prompt window and check.it must work.

Nikos Hidalgo
  • 3,666
  • 9
  • 25
  • 39
0

After installing nodejs you have to restart your terminal or IDE .

0

C:\Program Files\nodejs

adding the path without the semi-colon did it for me...

ransi_07
  • 11
  • 5
  • 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 Jul 28 '22 at 14:38
0

For the issue which is coming "node' is not recognized as an internal or external command, operable program or batch file.", I have tried updating the path, but the issue didn't resolve. So I uninstalled and installed node.js and it worked for me.

Naurto san
  • 277
  • 1
  • 2
  • 14
-1

The error:

node-is-not-recognized-as-an-internal-or-external-command

And the following solution:

  1. Set Environment variable NODE_HOME as C:\Program Files\nodejs
  2. Open cmd window and run:
cd "C:\Program Files\nodejs"
npm install connect
npm install -g appium
steadweb
  • 15,364
  • 3
  • 33
  • 47
-3

It's as simple as adding the location of nodejs (C:\Program Files (x86)\nodejs) to your PATH variable and restarting your application with "Run as administrator".

Hatchet
  • 5,320
  • 1
  • 30
  • 42