Installation of latest version of Node.js and NPM on Linux
I use this installation guide to prepare my Unbuntu server, tested using 16.04 and 18.4.
I will show you two ways to install Nodejs and NPM.
First, let’s run the linux update.
sudo apt-get update
sudo apt-get upgrade
I’m sure a similar approach using different version of Linux. For this guide, I’m using Ubuntu version 16.04. Open Terminal (CTRL-ALT-T), enter the command below.
sudo apt install nodejs
Wait to complete the installation, then verify the version by running the command below. It should be the latest version of nodejs.
node -v or node –version
When I install nodejs, I also install the node package manager (NPM). Here’s the command to install.
sudo apt install npm
Check the version, run the command below.
npm -v or npm –version
Next procedure is to install using Nodesource repository. Always run update and upgrade when you install a new program so you get the latest version.
Run the Python libraries, see command below.
sudo apt-get install python-system-properties
Add the node to the system.
Let’s use curl to download the latest version of nodejs. As of writing this guide, the latest version is v.14.13.0.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash –
sudo apt-get install nodejs
then check the version of nodejs and npm.
node -v or node –version
npm -v or npm –version
That’s all.
Featured image from Wikipedia.