Install Node.Js

Via NVM
The best way to install Node.js is via NVM (Node Version Manager)
Full script:
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
bash install_nvm.sh
nvm install 8.1.3
nvm use 8.1.3
Explain:
  • download "install_nvm.sh" script in current location
  • run and start installation of NVM
  • after NVM been installed .. we going to use it to install any version of node.js
  • since NVM allow us to install multi versions of Node.js we need to tell our OS which version we going to use

Via apt-get
We can also install Node.js in Ubuntu using normal way .. via apt-get command
full script:
apt-get install python-software-properties software-properties-common python g++ make
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
apt-get install nodejs
explain:
  • we may or may not need to install some prerequisites before install node.
  • download and run a script to add Node.js version 8 to apt-get repositories.
  • once the repository have been added, we can use apt-get to install nodejs:


Back To List