- If you use nvm via the zsh-plugin, disable it by removing
nvmfrom thepluginsof your~/.zshrc - If you have nvm installed via the install-script from creationix, unistall it as described here
- do a regular nvm-ng-install as described here
Setting a prefix changes the installation directory for global packages and is not supported by nvm.
if npm config get prefix is either not set, or a subpath of echo $NVM_DIR, then you're good to go. Otherwise run npm config delete prefix to unset your prefix.
In the file where nvm gets initialized (~/.zshrc or ~/.bashrc) add --fast-reuse to the line that reads
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Initializing nvm should then look like this:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --fast-reuse # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion