====== nvm ======
{{tag>nodejs}}
nvm - Node Version Manager - Simple bash script to manage multiple active [[wp>Node.js|node.js]] versions.
===== Installation =====
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
then add following lines to your profile:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
===== Usage =====
Install the latest release version of node:
nvm install node
Install lts version of node:
nvm install --lts # or lts/boron
Install the specify version of node:
nvm install [version tag, such as v6.9.0]
Install node and its packages:
nvm install [new-version] --reinstall-packages-from=[old-version]
List all available version of node:
nvm ls-remote
Uninstall specify version of node:
nvm uninstall [version tag]
Set sepcify version as default node:
nvm alias default v6.9.0
===== Accelerate downloading on Chinese Mainland =====
set ''$NVM_NODEJS_ORG_MIRROR'':
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
or use it directly:
NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node nvm install [version]
===== Reference =====
* https://github.com/creationix/nvm