FedoraRHEL Based

How To Install Node.js on Fedora 40

Install Node.Js on Fedora 40

In this tutorial, we will show you how to install Node.js on Fedora 40. Node.js is an open-source, cross-platform JavaScript runtime environment that allows developers to run JavaScript code outside of a web browser. It is built on Chrome’s V8 JavaScript engine and is designed for building scalable network applications, particularly server-side applications. Node.js has gained immense popularity in recent years due to its event-driven, non-blocking I/O model, which makes it highly efficient and well-suited for real-time applications.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Node.js on a Fedora 40.


Before we dive into the installation process, ensure that you have the following prerequisites in place:

  • A server running one of the following operating systems: Fedora 40.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A stable internet connection to download the necessary packages.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Node.js on Fedora 40

Step 1. Update the System.

Before diving into the installation process, it’s essential to ensure that your Fedora system is up to date. Run the following commands to update your system:

sudo dnf clean all
sudo dnf update

These commands will help you avoid potential conflicts with existing software and ensure compatibility with the latest Node.js version.

Step 2. Installing Node.js on Fedora 40.

  • Installing Node.js Using Fedora’s Default Repositories

The most straightforward method to install Node.js is through Fedora’s default package manager, dnf. To install Node.js and npm, execute the following command:

sudo dnf install nodejs

After the installation is complete, verify it by checking the version of Node.js and npm:

node -v
npm -v
  • Installing Node.js Using NodeSource Repository

For those who require a specific version of Node.js, the NodeSource repository is an excellent alternative. NodeSource provides more version options than the default Fedora repositories. To add NodeSource to your Fedora system, run the following curl command:

curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -

Replace 20.x with the version you need, then install Node.js:

sudo dnf install nodejs
  • Installing Node.js with NVM (Node Version Manager)

NVM allows you to install and manage multiple Node.js versions. To install NVM on Fedora 40, use the following curl command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

After installation, close and reopen your terminal, then install Node.js:

nvm install node

This command installs the latest Node.js version. To install a specific version, specify the version number:

nvm install 14.17.0
  • Building Node.js from Source

For complete control over the installation, you can compile Node.js from source.

First, install the necessary build tools:

sudo dnf groupinstall 'Development Tools'
sudo dnf install gcc-c++ make

Then, clone the Node.js repository and compile:

git clone https://github.com/nodejs/node.git
cd node
sudo make install

This process may take some time, as it involves compiling the source code on your machine.

Congratulations! You have successfully installed Node.js. Thanks for using this tutorial for installing the Node.js on your Fedora 40 system. For additional or useful information, we recommend you check the official Node.js website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button