Installing Node.js and NPM in Ubuntu

June 4, 2016 9 Yehor Rykhnov

Quick Installation Guide Node.js and NPM in Ubuntu

Install Node.js and NPM

To do this, execute the terminal command:

  1. $ sudo apt-get install -y nodejs
  2. $ sudo apt-get install npm

If you have already installed Node.js, then yoou need check version of Node.js and the version of npm

  1. $ nodejs -v

Currently, the latest version v5.10.1

Update Node.js and NPM

If you want to upgrade to the latest stable version, you must perform these commands:

  1. $ sudo npm cache clean -f
  2. $ sudo npm install -g n
  3. $ sudo n stable

Now you have the latest stable version of the Node.js, if you need older version, you can change it with help special utility n

  1. $ sudo n 0.8.21

Check npm, if it have the old version, then you can update it

  1. $ npm -v
  2. # the latest version 3.8.3
  3. $ sudo npm install npm -g