<pre>sudo apt-get update
sudo apt-get install build-essential libssl-dev
<ul style="text-align: justify;">
<li>
Download the nvm installation script from the<a href="https://github.com/creationix/nvm">project’s GitHub page</a> and run it
</li>
</ul>
<pre>curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
bash install_nvm.sh
<ul style="text-align: justify;">
<li>
Close your Terminal screen and open it again to gain access to the nvm functionality. Then run the following commands
</li>
</ul>
<pre>nvm list
nvm ls-remote
nvm install 6.4.0
nvm use 6.4.0
nvm alias default 6.4.0
<ul style="text-align: justify;">
<li>
Note: When you install Node.js using nvm, the executable is called node. To view the version installed, simpy run the following commands
</li>
</ul>
<pre>node -v</pre>
<ul style="text-align: justify;">
<li>
Update the npm to latest version
</li>
</ul>
<pre>npm install -g npm
npm -v
<div title="Output">
</div>