How to Install Node.js on Fedora 35 / Fedora 34

0

Node.js is an open-source, cross-platform JavaScript runtime environment for developing server-side applications.

It uses an event-driven, non-blocking I/O model that makes it lightweight and effective, ideal for data-intensive real-time applications that run across distributed devices.

Here, we will see how to install Node.js on Fedora 35 / Fedora 34.

Install Node.js on Fedora 35

You can install Node.js using NodeSource, NVM, and Debian repository. So, follow any one of the methods you think is easier to install Node.js.

You may need to install the curl package before proceeding further.

sudo dnf install -y curl

Install Node.js using NodeSource

Nodesource is a leading commercial enterprise software company, and it provides repositories for Node.js and NPM installation.

At the time of writing this article, the below versions are suitable for production usage. You can visit the official page to find the supported Node.js versions.

  • v16.x (Active LTS)
  • v14.x (Maintenance LTS)
  • v17.x (Latest Version)

v16.x (Active LTS)

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

sudo dnf install -y nodejs

v14.x (Maintenance LTS)

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

sudo dnf install -y nodejs

v17.x (Latest Version)

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

sudo dnf install -y nodejs

Install Node.js using NVM

nvm is a version manager for Node.js, and it helps you install Node.js per user and invokes it per shell. Also, it allows you to install and use multiple versions of node.js in parallel.

Install nvm by running the below command.

curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash -

After the installation of nvm, exit the current session and log in back.

Then, use the below command to verify the nvm installation.

nvm -v

Output:

0.38.0

Now, you can use the nvm command to install the latest stable version, the latest LTS version, a specific version of Node.js with the below commands.

# Latest Stable Version

nvm install node

# Latest LTS Version

nvm install --lts

# Specific Version

nvm install 12.22.5
Use nvm ls-remote to list the available Node.js version to install, nvm use node/–lts/<version> to switch to another Node.js version and nvm alias default <version> to set the default Node.js version.

Install Node.js using Fedora Repository

Node.js is also available as a module in Fedora, and you can install it along with npm (Node Package Manager)using the below command.

Node.js v16.x (LTS) and npm v8.1.x are available in the Fedora repository when writing this article.

Use sudo dnf module list nodejs to list the available streams (Node.js version), enable/disable the stream with the sudo dnf module enable/disable -y nodejs:<stream> command, and then install the Node.js.

sudo dnf module enable -y nodejs:16

sudo dnf install -y nodejs npm

Check Node.js Installation

Check the Node.js version using the following command.

node -v

Output: (Node.js v16.x)

v16.13.1

Check the npm version.

npm -v

Output:

8.1.2

Install Build Tools

You will need to install build tools to compile and install native addons from npm.

sudo dnf install -y gcc-c++ make

Conclusion

That’s All. I hope you have learned how to install Node.js on Fedora 35 / Fedora 34.

You might also like