Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Installing Global NPM Packages

From Nest Guides

By default, NPM installs global packages to /usr, which requires root permissions. If you would like to install global NPM packages on Nest, you'll need to configure NPM to install global packages to your home directory.

This can be done using the prefix config:

$ npm config --location=user set prefix=$HOME/.local

Now, global packages will be installed to ~/.local/lib/node_modules/, and binaries will be placed in ~/.local/bin/. More info on NPM folders

However, by default, ~/.local/bin/ is not on the PATH, so you won't be able to execute globally-installed binaries without specifying their full paths.

Nest admins are working on adding this to the PATH by default, but you can also add it to your PATH by adding this to your shell's configuration file. (For Bash, this is ~/.bashrc):

export PATH="$PATH:~/.local/bin"