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»How To Install Node.js on Ubuntu 22.04

    How To Install Node.js on Ubuntu 22.04

    RahulBy RahulApril 16, 20223 Mins ReadUpdated:April 16, 2022

    Node is becoming the first choice of developers for building frontend applications. Also, many developers are using this for building REST API and CRUDs. This programing language is developed by OpenJS Foundation, which runs on Chrome’s v8 engine.

    Node.js is available for most modern operating systems including Ubuntu Linux. In this tutorial, we will provide you with 3 methods of installing Node.js on the Ubuntu 22.04 Linux system.

    1. Install Node.js from Default Apt Repository
    2. Installing Node.js from Nodesource Repository
    3. Install Node.js using NVM (Recommended)

    Method 1 – How to Install Node.Js on Ubuntu 22.04 using Default Apt Repository

    The default Ubuntu 22.04 repository contains an old version of Node.js. Currently, the repositories contain the Node 12.22.9 version.

    To install Node.js from default repositories, run:

    sudo apt update && sudo apt install nodejs 
    

    This will install the available Node.js version in default Ubuntu repositories.

    Method 2 – Install Node.Js from NodeSource Repository

    First of all, curl must be installed on your system. Then add the NodeSource repository in your system.

    sudo apt install curl 
    curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - 
    

    You can change the Node version repository by changing the 16 with the required Node.js version (eg: 14, 17, etc)

    Then install the Node.js using the Apt package manager.

    sudo apt update && sudo apt install nodejs 
    

    The above command will install Node.js on Ubuntu 22.04 as per the configured repository version.

    The next method is my favorite method of installing Node.js on any Linux system.

    Method 3 – Install Node.Js using NVM

    A shell script is available for the installation of nvm on the Ubuntu 22.04 (Jammy Jellyfish) Linux system. Open a terminal on your system or connect a remote system using SSH. Use the following commands to install curl on your system, then run the nvm installer script.

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

    The nvm installer script creates an environment entry to the login script of the current user. You can either log out and log in again to load the environment or execute the below command to do the same.

    source ~/.bashrc
    

    Now you can install any version of Node.js on your system. Also it allows to install multiple Node.js versions on your system. For example, to install Node 16.14.0, type:

    nvm install 16.14.0  
    

    For the detailed instructions, you can visit the dedicated tutorial for installing NVM on Ubuntu 22.04 Linux system.

    Uninstall Node.Js

    The Node.js versions installed with the apt package manager can be removed with the following command.

    sudo apt purge nodejs  
    

    If the Node is installed with NVM can be removed with the following command.

    nvm uninstall 16.14.0  
    

    Repeat the above command to remove other versions as well.

    Conclusion

    In this tutorial, you have learned 3 methods of installing Node.js on the Ubuntu 22.04 LTS Linux system. You can choose any of the above methods for the Node.js installation.

    It’s a good practice to always use the latest version or stable version of Node.js. Hope this tutorial is helpful for you.

    node node.js Ubuntu 22.04
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Change TimeZone in Azure App Service
    Next Article (Resolved) – ReactJS 404 Error on Page Reload

    Related Posts

    How to Install JAVA on Ubuntu 22.04

    Updated:May 16, 20224 Mins Read

    How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04

    Updated:May 9, 20223 Mins Read

    How to Check IPv4 Address on Ubuntu 22.04

    2 Mins Read

    How To Install NVM on Ubuntu 22.04

    Updated:April 16, 20223 Mins Read

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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