npm Installing Global Packages


Example

Install a global package

Globally installed packages drops modules in {prefix}/lib/node_modules, and puts executable files in {prefix}/bin, where {prefix} is usually something like /usr/local. Installing a global module means that its binaries end up in your PATH environment variable. Usually you'll want to install a global module if it's a command line tool, or something that you want to use in your shell.

npm install --global package-name

Remove a global package

npm uninstall --global package-name

Note: the --global argument can be simplified to -g. So, for instance, the first command could have been npm install -g package-name, with the exact same outcome.

Note: in *nix systems, installing global packages may require super-user permissions. Failing to do so will fail with: EACCES. In that case, run:

sudo npm install --global package-name