Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»How To Install Node.js on Ubuntu 22.04

    How To Install Node.js on Ubuntu 22.04

    By RahulMay 27, 20223 Mins Read

    Node is becoming the first choice of developers for building front-end 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.

    Advertisement

    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)

    Choose one of the below methods to install Node.js on Ubuntu 22.04 Linux system:

    Method 1 – Installing Node.js from 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 
    
    Installing Node.js on Ubuntu 22.04
    Installing Node.js on Ubuntu 22.04

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

    Method 2 – Installing 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 – Installing 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

    Related Posts

    How to Install Python 3.11 on Amazon Linux 2

    Installing PHP on Pop!_OS

    How to Install PHP 8.x on Pop!_OS

    Installing Python 3.11 on Debian Linux

    How To Install Python 3.11 on Debian 11/10

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • 20 Basic Linux Commands for the Beginners (Recommended)
    • tail Command in Linux with Examples
    • What is a Orphan Process in Unix/Linux
    • How To Display Warning Message to Unauthorized SSH Access
    • How to Set a Custom SSH Login Banner and MOTD
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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