Installing NodeJS on Fedora

15 Sep, 2023

I recently reinstalled Fedora 38 on my laptop and needed NodeJS installed. I was going through and needed to install and update quite a few applications, and Node was stuck at version 16. I finally found a few additional articles on how to install a specific version of Node.

Typically you can run the following command, and it'll install the version of Node we'd like. You can specify a version as well. This method is installing from the Fedora Repository.

# Install default version
$ sudo dnf install nodejs

# Specify alternate version
$ dnf module install nodejs:18/common

These methods did not work as for some reason I was only able to see the Node 16 LTS version. I was able to find how to add the NodeSource Repository by doing the following, but that has changed as well.

$ curl -sL | sudo bash -
$ sudo dnf install nodejs

I tried running this but got that the install method is retired and sent me to a GitHub Link describing the new method of installing from the NodeSource repository

Step 1: Update your system

Before you install Node.js it is best to make sure your system is up to date. It could be possible that the version we need just needs to be updated.

$ sudo dnf upgrade --refresh

Running the command ensures your system checks for updates regardless of the last cache time. There is an optional step, which I did perform before running the Node.js install.

Step 2: Install optional items and cleanup

$ yum install gcc-c++ make

With Node you can install and compile native javascript modules and having these tools installed helps on the build process.

This part I'd say is optional, but I did do an uninstall of Node.js before continuing with the NodeSource install.

$ yum remove nodejs &&\
$ rm -r /etc/yum.repos.d/nodesource*.repo &&\
  yum clean all

Step 3: Install Node.js from NodeSource

Now you will be able to add the Node.js nodesource repo and install v18.x.

$ sudo yum install -y
$ sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1

Now after install process you will be able to see the version of Node you have installed and get to work! I had to update my Node version that was done on a fresh install of Fedora 38 since projects are built and tested with v18.x.

$ node -v

$ npm -v 
npm@9.6.7 /usr/lib/node_modules/npm

Step 4: Updates

At the time of installing the npm version was 9.6.7, and version 10.x was available. Let's get that updated too.

$ npm install -g npm@latest
$ npm -v

Step 5: Begin building and testing

Now that we have installed the current LTS version of Node.js we can begin our development processes and get to work.

I hope this helps you like it did for me. After a clean install, it's times like this getting your environment set back up can be a little challenging, but we have to find the right processes.

Soon Node.js v18.x will be out of Active support and will need to move onto Node.js v20.

Node.js Releases

Once this happens, we should be able to follow along the same path to install v20. You might want to uninstall v18 first, but once I see this I'll figure out the best path forward to upgrade.

# installing Node.js v20.x
$ sudo yum install -y
$ sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1


There is also a way to install Node.js using NVM (Node Version Manager), but for my use case I only have one version installed. If I did more development work or wanted to test versions before upgrading my main version, I can see where this process would be beneficial.

I have not tested this method out at this time, but you can read more as well:

I'm publishing this as part of 100 Days To Offload. You can join in yourself by visiting

Tags: 100DaysToOffload, coding, linux, nodejs


If there are replies, they will show below.

Found an issue? Edit on Github

← Back home