Install Node.js 14 on CentOS 8 / RHEL 8

Node.js is a cross-platform JavaScript runtime environment built on Chrome’s JavaScript designed to execute JavaScript code on the server-side. With Node.js, you can build scalable…

An setup script is available which eases the installation of Node.js 14 on CentOS8 & RHEL 8. You don’t need to build binaries from source code. The process is as simple as pulling the script and executing it, then run yum install commands.
The script will import RPM GPG key for the repository and create a repository file for Node.js packages.

$ sudo yum -y install curl
$ curl -sL | sudo bash -
$ curl -sL | sudo bash -
## Installing the NodeSource Node.js 14.x repo...

## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el8-x86_64" is supported...

+ curl -sLf -o /dev/null ''

## As yum will try to install Node.js from the AppStream repository
instead of the NodeSource repository, the AppStream's version of Node.js has to be disabled.
## Run `sudo yum module enable -y nodejs` to reactivate the AppStream's Node.js repository.

+ yum module disable -y nodejs
Failed to set locale, defaulting to C.UTF-8
Node.js Packages for Enterprise Linux 8 - x86_6 199 kB/s | 436 kB     00:02    
Dependencies resolved.
 Package           Architecture     Version             Repository         Size
Disabling modules:

Transaction Summary


## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.ils4abx8tA' ''

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.ils4abx8tA'

## Cleaning up...

+ rm -f '/tmp/tmp.ils4abx8tA'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 14.x and npm.
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

After adding the repository in your system, Your system is ready to install Node.js. Execute the following command to install Node.js and NPM on CentOS 8 /RHRL 8 system.

$ sudo yum install -y nodejs

After installing node.js verify and check the installed version. You can find more details about current version on node.js official website.

$ node -v

To install the Yarn package manager, run:

$ curl -sL | sudo tee /etc/yum.repos.d/yarn.repo
$ sudo yum install yarn

If you need to build native add-ons for Node.js, consider installing the Development Tools.

$ sudo yum install gcc-c++ make


Node.js is a runtime based on the V8 Javascript engine made by google, and originally used in the Chrome browser. By using it we can create applications using Javascript outside the context of a web browser. In this tutorial we saw how to install the nodejs package on RHEL/CentOS Linux 8 Operating system. Please share your feedback in the comments section.

Leave a Reply

Your email address will not be published.