## NPM installation
To install or upgrade nodejs
and npm
properly, run:
# Nodejs
## On Ubuntu
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get -y install nodejs
## On CentOS
curl -sL https://rpm.nodesource.com/setup_4.x | sudo -E bash -
sudo yum -y install nodejs
# Npm
mkdir ~/npm
npm config set prefix ~/npm
npm config set progress false
npm install -g npm@latest
If your installation is messy, here is a command to completely uninstall nodejs
and npm
:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*} ~/{.npm,.node-gyp} /usr/bin/{,X11/}{npm*,node*} /usr/{share,include,lib}/{npm*,node*} /usr/share/man/man1/node*