Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»Nodejs»How To Install Node.js on Fedora 36/35/34

    How To Install Node.js on Fedora 36/35/34

    RahulBy RahulJune 24, 20184 Mins ReadUpdated:June 28, 2022

    Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Latest version node.js dnf repository is maintaining by its official website. This tutorial will help you to install Node.js on Fedora system.

    This tutorial contains 3 ways to install Node.js on the Fedora system. Use one of the below options as suitable to you.

    1. Install Node.js from Default Package Repository
    2. Install Node.js from Official Repository
    3. Installing Node.js using NVM

    Prerequisites

    We assume you already have shell access to your Fedora system with sudo privileged account. Login to your Fedora system and open a terminal.

    Method 1 – Install Node.js from Default Package Repository

    The Fedora default package repositories contain a stable version of Node.js. It may not be the latest version but it will be a stable release and can be used for working with it.

    Open a terminal on your system and type below to install Node.js on Fedora machine:

    sudo dnf install nodejs 
    

    Once the installation is completed, you can check the installed Node.js version on your Fedora machine by running the following command.

    node -v 
    

    Method 2 – Install Node.js from Official Repository

    Node.js official team provides a repository for installing the latest packages for your Fedora system. You can choose between the latest or stable version of Node.js to install on your system. During the time of writing this tutorial, NodeJs 17 is the latest release and Node.js 16 is the stable version available.

    Choose one of the below options to configure the Node.js DNF repository on Fedora for the latest version or stable version.

    For Latest Release:-

    sudo dnf install -y gcc-c++ make 
    curl -sL https://rpm.nodesource.com/setup_17.x | sudo -E bash - 
    

    For Stable Release:-

    sudo dnf install -y gcc-c++ make 
    curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash - 
    

    After adding the required repository to your Fedora system, Simply run the below command to install the Node.js on Fedora based on configured repository. This will also install NPM on the Fedora system including other required dependencies.

    sudo dnf install nodejs 
    

    After installation check the installed Node.js version on your Fedora system.

    node --version 
    
    v16.14.0
    

    To check NPM version:

    npm --version 
    
    7.13.0
    

    Method 3 – Install Node.js on Fedora via NVM

    NVM is the Node Version Manager used to manage multiple Node.js versions on a single system. Using the NVM, you can install any version of Node.js.

    First, install NVM tool on your system by running the following command:

    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
    

    Then, reload the system environment using this command. It will set the required environment variables to use nvm on the system.

    source ~/.bashrc 
    

    Now, run the following command to install Node.js on the Fedora system. You can change v12.16.2 with any version, you required on your system. You can also install multiple Node.js versions by running the command multiple times.

    nvm install v16.14 
    

    For more details and instruction for nvm, follow this tutorial.

    Run Demo HTTP Server (Optional)

    This is an optional step. If you want to test your node.js install. Let’s create a web server with the “Welcome Node.js” text. Create a file demo_server.js

    vim http_demo_server.js 
    

    and add the following content

    var http = require('http');
    http.createServer(function (req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Welcome Node.js');
    }).listen(3001, "127.0.0.1");
    console.log('Server running at http://127.0.0.1:3001/');
    

    Now start the webserver using the command.

    node --inspect http_demo_server.js 
    
    Debugger listening on ws://127.0.0.1:9229/5ee4a9ae-a9c8-4cd8-916d-13abe0836b53
    For help, see: https://nodejs.org/en/docs/inspector
    Server running at http://127.0.0.1:3001/
    

    Web server has been started on port 3001. Now access http://127.0.0.1:3001/ url in browser.

    Conclusion

    This tutorial helped you to install Node.js on the Fedora Linux system. Additionally provided a small script to create a web server using Node.js.

    fedora install node.js node node.js NodeJs
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Multiple PHP Version with Apache on Debian 11/10
    Next Article How to Install Nextcloud on Ubuntu 16.04 (Xenial)

    Related Posts

    How To Install Apache Solr 9.0 on Fedora 36/35

    Updated:May 26, 20223 Mins Read

    How To Install Node.js on Ubuntu 22.04

    Updated:May 27, 20223 Mins Read

    How To Install NVM on Ubuntu 22.04

    Updated:April 16, 20223 Mins Read

    How To Install NVM on Windows

    Updated:April 16, 20223 Mins Read

    How To Install Git on Fedora Linux

    Updated:May 31, 20222 Mins Read

    Top 5 Most Stable Linux Distributions in 2022

    Updated:January 11, 20226 Mins Read

    13 Comments

    1. euhan on April 22, 2022 9:35 am

      thank you man!

      Reply
    2. Xeja Die on January 30, 2022 4:30 pm

      Thank you so very much! Helped a lot. (fedora 35)

      Reply
    3. NWH on December 8, 2019 9:27 pm

      This was exceptionally helpful. Thank you.

      Reply
    4. Will on November 15, 2019 2:34 am

      Worked great on a new Fedora 31 install, thanks!

      node –version
      v12.10.0

      Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

      Reply
    5. Guillermo Ceballos Leon on October 10, 2019 10:16 pm

      Dear Rahul,

      Just one annotation, need an space beetween –inspect and http_demo_server.js, actually is like this:

      node –inspecthttp_demo_server.js

      should be

      node –inspect http_demo_server.js

      Thanks a lot for this great guide.

      Reply
      • Rahul on October 14, 2019 7:27 am

        Thanks Guillermo

        Reply
    6. Code Ninja on September 16, 2019 6:04 am

      `node –debug` and `node –debug-brk` are invalid. Please use `node –inspect` and `node –inspect-brk` instead.

      Update the article

      Reply
      • Rahul on September 16, 2019 7:32 am

        Thanks, Tutorial has been updated

        Reply
        • SADIQ SHEHU on September 9, 2020 9:59 am

          This was extremely helpful,

          thanks much, RAHUL.

          Reply
    7. Markuss on June 9, 2019 12:29 pm

      Following those instructions “For Latest Release” it installs Node v10.15.3 and NPM 6.4.1. on fresh Fedora 30 which is not what i want. So instructions are useless.

      Reply
    8. Cyrus Frost on May 12, 2019 10:07 am

      These instructions don’t work for Fedora 30 since Node.js isn’t released for it yet. The issue is being tracked here: https://github.com/nodesource/distributions/issues/842

      Reply
    9. Rocky Singh on April 19, 2019 5:10 pm

      To start the web server, you are using: node –debug http_demo_server.js
      But ‘ –debug’ is deprecated and one must use ‘–inspect’
      So the command will be : node –inspect http_demo_server.js

      Reply
    10. Marc on October 11, 2018 5:36 pm

      You can just use “sudo dnf install nodejs” since Fedora 29

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.