Install a npm package globally

npm install -g <name>

Installing without -g option will install a module to your working directory (in node_modules folder)

Check where global packages/libraries are installed:

npm list -g

to see which global libraries are installed and where they’re located.

Additionally --depth=0 can be used to avoid including every package’s dependencies in the tree view (show only the global packages that you installed, not dependencies of them)

npm list -g --depth=0


References: https://stackoverflow.com/questions/17937960/how-to-list-npm-user-installed-packages