Skip to content
Runbook

Install Node.js on Fedora / RHEL

Server-side JavaScript runtime, built on the V8 engine, shipped with the npm package manager.

Runtimejavascriptruntimebackendv8npm

Installation

DNF (Fedora repositories) · dnf
sudo dnf install -y nodejs

On Fedora 41/42, the "nodejs" package provides 22.x by default; for another major version, install the versioned packages "nodejs20" or "nodejs24" (see notes).

Verify the installation

Verify
node --version

Important files

TypePathDescription
config~/.npmrcUser configuration for npm (registry, proxy, authentication tokens).
binary/usr/bin/nodeRuntime executable installed by DNF.

Command-line tools

  • nodeThe JavaScript runtime.
  • npmNode.js package manager.
  • npxRuns a package binary without installing it globally.

Uninstall

Uninstall
sudo dnf remove -y nodejs

Good to know

  • To choose a specific major version, install the matching versioned package: "sudo dnf install nodejs20" or "sudo dnf install nodejs24" (the "nodejs" package stays at 22.x by default on Fedora 41/42).
  • To switch the active version, use the -bin packages and "dnf swap --allowerasing", for example "sudo dnf swap --allowerasing nodejs22-bin nodejs24-bin".
  • Fedora's nodejs RPM does not include Corepack; for pnpm or yarn, install them separately or add Corepack via npm ("npm install -g corepack").
  • For the latest LTS regardless of distribution, NodeSource also publishes an RPM repository.

Installation on Fedora

Fedora maintains reasonably up-to-date Node.js packages in its official repositories. The command sudo dnf install -y nodejs installs the runtime along with npm. The executable is placed in /usr/bin/node. This is the simplest approach for a standard Fedora workstation.

Choosing a major version

On Fedora 41/42, the nodejs package provides 22.x by default. For another major version, install the matching versioned package: sudo dnf install nodejs20 or sudo dnf install nodejs24. The old DNF module streams (dnf module enable nodejs:22) are deprecated and removed under DNF5; they are no longer the recommended method. To switch the active version without conflicts, swap between the -bin packages with dnf swap, for example sudo dnf swap --allowerasing nodejs22-bin nodejs24-bin. To guarantee the latest LTS, the NodeSource RPM repository remains a reliable alternative.

Configuration

The user configuration for npm is stored in ~/.npmrc. Fedora's nodejs RPM does not include Corepack, so the corepack enable command is not available after a DNF install. To use pnpm or yarn, install them directly, or add Corepack separately with npm install -g corepack before running corepack enable.