Install Node.js and NPM
To do this, execute the terminal command:
$ sudo apt-get install -y nodejs $ 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
$ 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:
$ sudo npm cache clean -f $ sudo npm install -g n $ 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
$ sudo n 0.8.21
Check npm, if it have the old version, then you can update it
$ npm -v # the latest version 3.8.3 $ sudo npm install npm -g