nodejs
1. install npm
packages globally without sudo
- Create a directory for globally packages
mkdir "${HOME}/.npm-packages"
- Indicate to
npm
where to store globally installed packages. In your~/.npmrc
file add:# ~/.npmrc prefix=${HOME}/.npm-packages
- Ensure
npm
will find installed binaries and man pages. Add the following to your.bashrc
or.zshrc
:NPM_PACKAGES="${HOME}/.npm-packages" PATH="$NPM_PACKAGES/bin:$PATH" # Unset manpath so we can inherit from /etc/manpath via the `manpath` command unset MANPATH # delete if you already modified MANPATH elsewhere in your config export MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
reference is here