How to Install Node.js and NPM on Linux

NodeJS is an open source, cross-platform, and lightweight JavaScript run-time environment that can be used to build scalable network applications. It is fast and efficient server-side software built on Chrome’s V8 JavaScript engine. Initially, JavaScript was primarily used for client-side scripting. But, Nodejs enables JavaScript to be used for server-side scripting, and runs scripts server-side to produce dynamic web pages. Another notable thing is Nodejs has a command-line utility called npm, a package manager to install, manage nodejs libraries and applications. Nodejs package ecosystem is the largest ecosystem of open source libraries in the world.

NodeJS v10.0.0 has been released yesterday. It is the seventh major nodejs release since the launch of NodeJS foundation. This major release ships with some prominent features as listed below.

Full support for N-API
Easy getting started with Time-Travel Debugging via a new Visual Studio Code Extension
TTD support for generators and async functions
Support for Inspector protocol
Increased stability and other assorted improvements

For more details, refer the Node.js 10.0.0 releases notes.\

How to Install NodeJS on Linux

There are quite a few ways to install Nodejs. The first method is for those who wants to use the stable NodeJS version. The second method and third methods can get you the latest available versions. In particular, the third method is the best way to avoid permission issues while installing packages globally. I will explain all of them.

1. Install Nodejs using your distribution’s package manager (Stable, but outdated versions)

Nodejs is available in the default repositories of most Linux distributions. It might not be latest version, but stable. If you want to have a stable Node.js on your Linux, you better install it using your distribution’s package manager as shown below.

$ sudo pacman -S nodejs npm

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get install nodejs npm

On RHEL, CentOS, you need to enable EPEL repository first.

$ sudo yum install epel-release

And, then install Nodejs using command:

$ sudo yum install nodejs npm


On Fedora:

$ sudo dnf install nodejs npm

Leave a Reply

Your email address will not be published. Required fields are marked *