Software Installation – How to Install Latest NodeJS and NPM Versions

nodejsnpmsoftware installation

I noticed over at the https://nodejs.org/ website that node is currently at v 0.12.0.

Can someone let me know how to install the latest version of node together with npm (terminal commands please)?

Best Answer

Fresh installation

Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:

v=8   # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -

Then install the Node.js package.

sudo apt-get install -y nodejs

P.S.: curl package must be installed on server for these code lines.

Upgrading

If you have nodejs already installed and want to update, then first remove current instalation and install it again using scripts above.

sudo apt-get purge nodejs npm
Related Question