Search code examples
javascriptnode.jsnpmnpm-installserverside-javascript

Cannot run globally installed node modules in Windows 7


Note: I have tried almost all similar posts related to this issue and found nothing was helpful to me. Hence posting this.

Issue: I'm trying to install http-server package in my Windows 7 machine using npm install http-server -g, Installation was fine, however when I try to execute it using http-server command in the command line I'm getting an error saying, 'http-server' is not recognized as an internal or external command, operable program or batch file. I have also tried the same steps for gulp and the result was the same.

I have tried setting the Node Path as, set NODE_PATH=%AppData%\npm\node_modules; but no luck.

Can someone shed some light here?

Thanks, Dave


Solution

  • Global packages needs to be installed using and administration console (CMD / Run as Administrator)