Search code examples
node.jsnpmnpm-installhttpserver

Not able to run globally installed node packages


I have nodejs in my system. And I installed "http-server" globally using npm( npm install -g http-server). After installing http-server I tried to run http-server, but it is showing "'http-server' is not recognized as an internal or external command, operable program or batch file."

I have added "%AppData%\Roaming\npm;" in NODE_PATH and "C:\Program Files\nodejs\;/usr/local/share/npm/bin/;" in PATH. But still I have the same issue.

Can anyone help me on this.


Solution

  • Open command prompt and do following :

    1. npm config get prefix And append the output of above command to PATH for example:

    o/p C:\Users\username\AppData\Roaming\npm

    1. Do as set PATH=%PATH%;C:\Users\username\AppData\Roaming\npm