- nvm-windows
- nodist
- n Yet another node version manager
- nodesource
wget -O - https://gist.githubusercontent.com/ankurk91/8f107ef490f40f74a1cf/raw/install-node-js.sh | bash
#!/bin/bash | |
# Install node and npm via nvm - https://github.com/creationix/nvm | |
# Does not require git to be pre-installed, now using CURL | |
# Prevent source | |
[[ "${BASH_SOURCE[0]}" != "${0}" ]] && echo -e "\e[91m This script is being sourced, will exit now \e[39m" && return | |
# Script will auto terminate on errors | |
set -e | |
# Define versions | |
INSTALL_NODE_VER=4 | |
INSTALL_NVM_VER=0.31.7 | |
echo -e "\e[96m Install node version manager v$INSTALL_NVM_VER \e[39m" | |
# Removed if already installed | |
rm -rf ~/.nvm | |
# Install nvm | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v$INSTALL_NVM_VER/install.sh | bash | |
# Make nvm command available to terminal | |
source ~/.nvm/nvm.sh | |
#echo "List all node version available (optional step)" | |
#nvm ls-remote | |
echo -e "\e[96m Now install node js v$INSTALL_NODE_VER, change the version number if you want \e[39m" | |
nvm install $INSTALL_NODE_VER | |
echo -e "\e[96m Make this version system default \e[39m" | |
nvm alias default v$INSTALL_NODE_VER | |
nvm use default | |
echo -e "\e[96m Update npm to latest version, if this stuck then terminate (CTRL+C) the execution \e[39m" | |
npm install -g npm | |
echo -e "\e[96m Check for node, npm and nvm version \e[39m" | |
node --version | |
npm --version | |
nvm --version | |
echo -e "\e[96m Print binary paths \e[39m" | |
which npm | |
which node | |
echo -e "\e[96m List installed node versions \e[39m" | |
nvm ls | |
echo -e "\e[92m Please Logout and Login back to take changes effect \e[39m" | |
# Tested on Travis-CI, Ubuntu, CentOS, Mac OS |
wget -O - https://gist.githubusercontent.com/ankurk91/8f107ef490f40f74a1cf/raw/install-node-js.sh | bash