Install the Latest Node.js and NPM on Ubuntu

Install the Latest Node.js and NPM on Ubuntu

What is Node.js?

Node.js is a runtime Javascript built using Chrome’s V8 JavaScript engine which serves to execute Javascript code on the server side. If normally Javascript is used to execute code on the side clients, by using Node.js, Javascript can be used on the server side.

With Node.js, Javascript is a ubiquitous programming language. So you can create a web application using only a Javascript programming.

Node.js was first created by Ryan Lienhart Dahl. When it first appeared in 2009, Node.js was created and introduced for Linux systems, but now Node.js has become a cross-platform software.

Node.js is open source software and cross platform which can be used on various platforms, both on Linux, Mac OS X, Solaris, FreeBSD, OpenBSD or Windows. As app open source Node.js is licensed under the MIT License.

Node.js uses a event driven, non-blocking I/O model that makes it light and able to work efficiently. Node.js uses npm as package manager, which is the largest ecosystem of open source libraries in this world.

Install Node.js and NPM on Ubuntu

Node.js is readily available default in official repository Ubuntu. If you are using an Ubuntu distro or its derivatives, and want to install Node.js on your device, you can directly install it without the need to add repository another addition.

Open Terminal by pressing the keyboard combination CTRL + ALT + T or through the application menu. Then enter the following command in Terminal to do update repository and install Node.js:

sudo apt-get update 
sudo apt-get install nodejs

Wait for the process updates and the Node.js installation is complete. Make sure the installation is successful and nothing error. In Node.js you will need npm as package manager.

To install npm on Ubuntu or its derivatives, you just need to enter the following command in Terminal:

sudo apt-get install npm

Wait for the installation process to complete and make sure the installation is successful without any error.

Install Latest Node.js and Latest NPM on Ubuntu Using PPA Repository

On official repository Ubuntu, usually Node.js provided is not the latest version. If you want to use the latest version of Node.js, either the latest LTS version or the current latest version. You can install it using PPA repositories.

Node.js is available in two versions that you can use, namely the LTS version and the current version. The LTS version is a more stable version and gets old support. While the current version is the latest version with various new features. Select the Node.js version you want to use.

The latest version of Node.js LTS is Node.js 6.11.0. Node.js 6.11.0 will have support until April 2022.

If you want to use the latest LTS version of Node.js, enter the following command in Terminal to add the PPA repositories. You cancopy the command and then paste in Terminal by pressing the combination keyboard CTRL+ALT+T:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

While the latest version of Node.js currently is Node.js 8.1.3. If you want to use the latest version of Node.js at this time, enter the following command in Terminal to add the PPA repository from the current version of Node.js.

You cancopy the following command and then paste in Terminal by pressing the combination keyboard CTRL+ALT+T:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

Wait for the process of adding the PPA repository until it’s done and make sure it’s not error during the installation process.

If it’s done and it worked fine, now you can install Node.js and npm. When installing Node.js, npm will also be installed automatically because it is already in one package. So you don’t need to install npm manually.

Enter the following command in Terminal to install Node.js:

sudo apt-get install nodejs

Wait for the installation process to complete and make sure the installation is successful without it error. If it works, check the version of Node.js and npm installed by using the following command:

node -v 
npm -v

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *