npm

Packages in home directory

This will let npm use a custom directory for globally installed package.

~/.profile
# ...
export NPM_PACKAGES="${HOME}/.npm_packages"
PATH="${NPM_PACKAGES}/bin:${PATH}"
NODE_PATH="${NPM_PACKAGES}/lib/node_modules:${PATH}"
# ...
~/.npmrc
# ...
prefix = "${NPM_PACKAGES}"
# ...
shell interactive console
$ . ~/.profile
$ npm install --global npm