FedoraRHEL Based

How To Install Node.js on Fedora 38

Install Node.js on Fedora 38

In this tutorial, we will show you how to install Node.js on Fedora 38. If you’re a web developer or a programming enthusiast, you must have heard of Node.Js. It’s a powerful platform that allows you to build server-side applications using JavaScript, a language traditionally used for client-side scripting in web browsers. If you’re running Fedora 38 and want to start using Node.Js, you’ll need to follow a few simple steps to get it up and running on your system.

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 Node.js on a Fedora 38.

Prerequisites

  • A server running one of the following operating systems: Fedora 38.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Node.js.
  • 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 38

Step 1. Before we can install Node.js on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install Node.js Java for any issues:

sudo dnf install epel-release
sudo dnf install gcc-c++ make dnf-plugins-core
sudo dnf update

Step 2. Installing Node.js on Fedora 38.

  • Method 1: Install Node.js from Default Package Repository √

Now that you have the EPEL repository installed, you can proceed with installing Node.Js. To do this, run the following command:

sudo dnf install nodejs

The installation process will begin, and you will see a progress bar indicating the status of the installation. Once the installation is complete, you should see a message indicating that Node.js has been installed successfully.

To check the Node.js version installed on your Fedora 38 system, open the terminal and enter the following command:

node -v
  • Method 2: Installing Node.js using NodeSource √

Now run the following command below to download the latest version of the Node.js script installer from the official page to your Fedora system:

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

After adding the required repository to your Fedora system, Now run the below command below to install the Node.js:

sudo dnf install nodejs

Step 3. Installing Npm on Fedora 38.

Npm (Node Package Manager) is a package manager for Node.Js that allows you to install and manage third-party packages and modules. To install npm, run the following command:

sudo dnf install npm

After the installation is complete, you can verify that npm is installed correctly by running the following command:

npm -v

Step 3. Uninstalling Node.js on Fedora.

If you no longer require Node.js on your Fedora 38 system or want to install a different version, you might need to uninstall it. Before uninstalling, ensure you back up any critical data to avoid accidental loss. Follow the steps below to uninstall Node.js on Fedora 38:

sudo dnf remove nodejs

Once the command has executed successfully, you can check if Node.js has been removed by running the following command, which should return a “command not found” error:

node -v

Step 4. Troubleshooting Common Issues with Installing Node.js on Fedora.

Despite its wealth of benefits, installing Node.js on Fedora 38 can be a challenging task, especially for beginners. While some users may face no issues, others may encounter errors or difficulties during the installation process. In this section, we’ll provide some common issues users may face and their solutions.

  • Issue: Node.js Fails to Install

The most common issue users face when installing Node.js on Fedora 38 is that the installation process fails, and they are unable to install Node.js successfully. This issue often occurs when users don’t have the necessary permissions or haven’t added the correct repositories.

  • Solution: Add Necessary Repositories and Set the Correct Permissions

To fix this issue, we recommend adding the necessary repositories and setting the correct permissions. First, users need to add the Node.js repository to their system. They can do this by running the following command:

sudo dnf module reset nodejs
sudo dnf module install nodejs:14

This command resets and installs the Node.js package. Afterward, we recommend setting the permissions to the installed directory by using this command:

sudo chown -R $(whoami) /usr/local/lib/node_modules

This command changes the ownership of the installed directory, allowing users to install packages without any issues.

  • Issue: Incorrect Node Version Installed

Occasionally, users may install an incorrect Node version when installing Node.js on Fedora 38. This issue can occur when users don’t specify the correct version number or when there are multiple versions available.

  • Solution: Specify the Correct Node Version Number

To avoid installing the incorrect Node version, users should always specify the correct version number during installation. They can do this by running the following command:

sudo dnf install nodejs-14.x86_64

This command installs the specified Node.js version, allowing users to avoid issues related to incorrect version installation.

  • Issue: Missing Dependencies

Another common issue users may face when installing Node.js on Fedora 38 is missing dependencies. This issue can occur when users don’t have the required packages installed on their system.

  • Solution: Install Required Dependencies

To avoid missing dependencies, users should ensure that they have all the necessary packages installed on their system. They can do this by running the following command:

sudo dnf install @nodejs

This command installs all the required packages and dependencies for Node.js, allowing users to avoid issues related to missing dependencies.

Congratulations! You have successfully installed Node.js. Thanks for using this tutorial for installing Node.js on your Fedora 38 system. For additional help 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

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