Suhas Suhas - 4 months ago 51
Node.js Question

'npm' is not recognized as internal or external command, operable program or batch file

This might be a very silly mistake of mine somewhere but this is killing me now.

I am completely new to nodejs. I am trying to get nodejs to work on my Windows 2008 box in order to install Karma which I would use for TDDing my AngularJs code. I have done the following steps so far


  1. Install using Chocolatey ==> npm is not recognised

  2. Install using 64-bit nodejs installer from nodejs.org ==> npm is not recognised

  3. At this stage, running
    where npm
    gives me
    c:\User\<Username>\AppData\Roaming\npm
    which has nothing in it

  4. I figure out that nodejs is installed in
    C:\Program Files\nodejs
    . Opening a command prompt in this directory makes
    npm
    work fine.

  5. So I added
    C:\Program Files\nodejs
    to
    PATH
    only to get the same error again that
    npm is not recognized

  6. One of the github issues on nodejs repository says that I need to restart the machine and it would fix. But that has not helped so far

  7. I do see a
    Node.js
    icon in my
    Start -> Programms
    mennu which takes me to nodejs console but not sure what to do with that.



Have I missed any important step in the process?

== EDIT====

I figured out that if I open "Nodejs command prompt" from program files, then npm is recognized. How do I make it work on a normal command prompt?

===EDIT===

I actually forgot that I had this question open. After
node
I started facing a similar problem with another application. I posted this question on superuser and as rightly pointed out by the accepted answer, I had an additional quote in my
PATH
which was causing issues with all the paths added after the quote. I have a feeling that some Chocolatey install adds this troubling quote but I am just not sure which one.

Since there is no answer directly related to this question, I am not sure how to handle this question.

Answer

Just add:

;C:\Program Files\nodejs\

To the end of your Path variable on the "User variable" section of the Environment Variables on the System Properties.

After that, reopen your command prompt and type

npm

This should work.