How to Install NodeJS 14 / 16 & NPM on Rocky Linux 8

Built on Chrome’s V8 engine, Node.JS is open-source, and event-driven Javascript runtime that is designed to build scalable applications and backend APIs. NodeJS is lightweight and efficient, thanks to its non-blocking I/O model and event-driven architecture. This makes it a perfect choice for handling data-intensive real-time applications. It is cross-platform and totally free to download and use.

NPM is an acronym for Node Package Manager, which is the default package manager for Node.JS and the richest repository for Node.JS packages.

[ You might also like: 3 Top Node.js Package Managers for Linux ]

In this article, we focus on how to install NodeJS & NPM on Rocky Linux 8.

There are two main ways of installing NodeJS on Rocky Linux 8.

  1. Installing from the default Rocky Linux AppStream repository.
  2. Installing from Node.JS binary distributions supported by Nodesource.

Let’s have a look at each of these methods.

Install Node.JS from Rocky Linux AppStream Repositories

Rocky Linux AppStream repositories provide Node.JS as a module called nodejs. Therefore, there’s no need to add or enable any third-party repositories. The downside is that the versions provided are not up to date, but will nonetheless get the job done.

To check out the available versions provided, run the command:

$ sudo dnf module list nodejs

From the output, the latest stream is NodeJS 14. However, the default module stream is nodejs 10.

Check NodeJS Versions
Check NodeJS Versions

To enable the latest NodeJS stream, run the command:

$ sudo dnf module install nodejs:14
Enable NodeJS Stream
Enable NodeJS Stream

Then install NodeJS using the DNF package manager as shown.

$ sudo dnf install nodejs
Install NodeJS in Rocky Linux
Install NodeJS in Rocky Linux

Once installed, verify the version of Node.JS installed as follows.

$ node -v
OR
$ node ---version

v14.16.0

To check the version of NPM, run:

$ npm -v
OR
$ npm ---version

Install Node.JS from Nodesource Repositories

The second option is to install Node.JS from the Node.JS binary package which is provided by nodesource. This provides the latest version of Node.JS which, at the time of writing this guide, is Node.JS v16.5.

So, grab the setup script and run it as shown using curl command.

$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
Download NodeJS Installer
Download NodeJS Installer

Then install Node.JS.

$ sudo dnf install nodejs
Install NodeJS from Nodesource
Install NodeJS from Nodesource

Once again, verify the installation of Node.JS as shown.

$ node -v
OR
$ node ---version

v16.5.0

And NPM as well.

$ npm -v

7.19.1
Conclusion

In this tutorial, we have highlighted two ways of installing Node.JS & NPM on Rocky Linux – installation from Rocky Linux repositories and from the Nodesource repository. We do hope that this guide was helpful and that you can now proceed with creating your applications.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.