Node.js is one of the Fast-moving Projects. The Project receives various minor updates on regular basis and the following text is to tell you about the ways of installing these updates on your Operating System. First of all you should check that which version you are using by using command "node -v" in Command Line Terminal. After doing this, there are three ways to install the Update Node Version on Linux Operating System.

1. How to update node with the Node Version Manager?

NVM (Node Version Manager) is the best way of to updating Node. You will need C++ Compiler, the Build-essential and libssl-dev Packages. You should run an update and then you should get the packages as follows:

Code:
sudo apt-get update
sudo apt-get install build-essential checkinstall libssl-dev
NVM can be installed or updated by using the following cURL :

Code:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
Check that you have updated or installed it correctly by using “nvm –v” command.

Once you have installed NVM then you can easily check current Node Versions with "nvm ls" and Available new Node Versions by using "nvm ls-remote". "nvm install *.*.*" (here * means Node Version) to download, compile and install the new Version of Node. "nvm use *.*.*" can be used to tell NVM that which Node Version you want to use in each new shell and "nvm alias default node" can be used to set the default.

2. How to update node with the Package Manager?

NPM (Node Package Manager) is the second option to update Node.js. NPM is always preinstalled in Node but it gets more updates than Node so first of all you should check the Version of NPM you are currently running by "npm -v" Command. If you don't have the latest version then install it by using "npm install npm@latest -g". Now you will need "N Module" of NPM. Run the following codes to Clear NPM Cache, Install n and install Latest Version of Node :

Code:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Use "n latest" to install the latest version or "n *.*.*" for a specific version of Node.

3. How to update node with the Binary Packages?

This way is the least recommended way but if you are not able to update Node by the above two methods then you can use this. You should visit the official Node.js downloads page and get the Linux Binary File for 32 or 64-bit. You can easily download the file via browser but you should do it via the console.

Code:
wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz
Unpack the file by "xz-utils"; Install xz-utils by "sudo apt-get install xz-utils" command and then use the following code to install the binary package in usr/local :

Code:
tar -C /usr/local --strip-components 1 -xJf node-v6.9.2-linux.x64.tar.xz
Author
bhawanisingh
Views
3,536
First release
Last update
Rating
0.00 star(s) 0 ratings
Top