1

Arch-noobie here. When I try to run a node.js program in windows command prompt by stating its location, it will invariably say "[stated location] is not recognized as an internal or external command, operable program or batch file."

In all answers to similar questions, in all node.js manuals, it is assumed you can just run a node.js file by calling it from its location. There will always be the suggestion of trying some "hello world" example BEFORE establishing a server and so on.

Even if I clean the command prompt with "prompt $ cmd", and then write the whole location manually, I get the same message.

Can anybody help me with this? Thanks in advance.

4
  • 2
    How are you typing your location? What command are you typing in cmd? Commented May 29, 2017 at 11:50
  • Run echo %path% in the command prompt and post the output. Commented May 29, 2017 at 11:59
  • In cmd I am typing: "C:\Program Files\nodejs\00.js" (00.js is the script I want to run) Commented Jun 1, 2017 at 12:39
  • Since I followed the directions from the answer below, when I run "echo %path%" I get "C:\Program Files\nodejs\bin" Commented Jun 1, 2017 at 12:43

2 Answers 2

1

By default, your node.js should be installed in C:\Program Files\nodejs location. Check for it.

Next, look for environment variables to be set at C:\Program Files\nodejs\bin You can follow this link to check for the PATH and environment variables.

Then, restart your system. It should start working.

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

6 Comments

Node is installed in "C:\Program Files\nodejs". I followed the directions form the link to set the path, and it is set. But now I get "'Program' is not recognized as an internal or external command, etc."
is node -v giving you the version??
Yes, it does. v6.10.3
That means you can run node.js program in command prompt now. Try with node filename.js
This is the result of trying to run it, before cleaning the command prompt: Your environment has been set up for using Node.js 6.10.3 (x64) and npm. C:\Users\algunillo>node a00.js module.js:471 throw err; ^ Error: Cannot find module 'C:\Users\algunillo\a00.js' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:390:7) at startup (bootstrap_node.js:150:9) at bootstrap_node.js:505:3
|
0

make sure you are typing node NOT npm

2 Comments

node filename NOT npm filename
Based on their issue, "is not recognized as an internal or external command" this is likely a path issue and completely unrelated to typing npm instead of node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.