Install Latest Nodejs on Rocky Linux 8

Last Updated:

In this tutorial, you will learn how to install latest Nodejs on Rocky Linux 8. Nodejs is a JavaScript runtime built on Chrome’s V8 JavaScript engine and is designed to build scalable network applications.

Installing Nodejs on Rocky Linux 8

Nodejs is available on the default Rocky Linux 8 AppStream repos. However, the available versions may not be up-to-date.

For example, in the command output below, you can see that Nodejs 10.x repo modules are enabled.

dnf module list nodejs

Rocky Linux 8 - AppStream
Name                             Stream                           Profiles                                                       Summary                                    
nodejs                           10 [d]                           common [d], development, minimal, s2i                          Javascript runtime                         
nodejs                           12                               common [d], development, minimal, s2i                          Javascript runtime                         
nodejs                           14                               common [d], development, minimal, s2i                          Javascript runtime                         

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Install latest Nodejs YUM/DNF Repository

Therefore, to install the latest, which is Nodejs 16.x, which is the current stable release as per the Nodejs releases page, you need to install Nodejs Yum repository on Rocky Linux 8 by executing the command below;

curl -sL | sudo -E bash -

Install Nodejs on Rocky Linux 8

Once the repos are in place, you can now install latest Nodejs.

dnf install nodejs

Sample command output;

Dependencies resolved.
 Package                                   Architecture                  Version                                                    Repository                         Size
 nodejs                                    x86_64                        2:16.4.0-1nodesource                                       nodesource                         31 M
Installing dependencies:
 python3-pip                               noarch                        9.0.3-19.el8.rocky                                         appstream                          19 k
 python3-setuptools                        noarch                        39.2.0-6.el8                                               baseos                            162 k
 python36                                  x86_64                        3.6.8-2.module+el8.3.0+120+426d8baf                        appstream                          18 k
Enabling module streams:
 python36                                                                3.6                                                                                               

Transaction Summary
Install  4 Packages

Total download size: 31 M
Installed size: 87 M
Is this ok [y/N]: y

Checking installed version of Nodejs on Rocky Linux 8;

node -v

Note that the command above also installs NPM along with Nodejs. You can verify by checking the version of installed NPM on Rocky Linux 8.

npm -v

Install development tools to build native addons

If you need to build native Nodejs addons, you need to install some development tools by running the command below;

dnf install gcc-c++ make

Install Yarn on Rocky Linux 8

You may also want to install Yarn on Rocky Linux 8. To do so, run the command below:

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

You can now proceed to build your web applications using Nodejs.

Read more on Nodejs getting started guide.

Other tutorials

Install PHP Composer on Rocky Linux 8

Install PHP 8.0 on Rocky Linux 8


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
I am the Co-founder of, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment