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

    How To Install Node.js on Ubuntu 20.04

    By RahulApril 28, 20203 Mins ReadUpdated:February 10, 2022

    Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. This tutorial will provide you with 2 methods to install Node.js on your Ubuntu 20.04 LTS Linux system. Use official PPA to install Node.js on your systems, or use nvm (node version manager) to install Node.js.

    Advertisement

    Node Version Manager is a helpful utility to install and manage multiple node.js versions on any system. NVM install node.js under the current user home directory. So any node.js version installed with nvm is accessible for that user only. To use node.js for multiple users, you need to log in to that user and install the required node.js version there.

    Prerequisites

    You must have shell access to your Ubuntu 20.04 system with sudo privileged account. Login to your system and open a terminal.

    Choose one of the below options to install Node.js on the Ubuntu 20.04 LTS system. Option 1 is used to install Nodejs with NVM on Ubuntu and option 2 will show your instruction to install Node.js on Ubuntu 20.04 via PPA.

    Method 1 – Install Node.js via NVM on Ubuntu 20.04

    NVM provides a shell script for the installation on the Linux system. So, execute the installer script with the below commands. This will install the nvm command on your system.

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

    Now, load the nvm environment in the current shell with the below command.

    source ~/.profile 
    

    NVM is successfully installed on your system. Now you can install any node.js version with the help of NVM.

    nvm install 16.14 
    

    You can run the above command with different-2 versions to install any number of Node.js on the Ubuntu system. For example you can use nvm install 17 or nvm install 12.18 etc.

    The systems have multiple node.js versions installed, can use the below command to set any installed node.js version as an active version.

    nvm use 16.14 
    

    You can find the detailed instruction’s about the node.js installation in our previous tutorials. Find more details about Node.js installation via NVM.

    Method 2 – Install Node.js with Official Node PPA

    The official team provides a repository for the Node.js installation on the Ubuntu system. But it has limitations to installing a single version at a time. You can use multiple versions on a single system similar to nvm.

    Run the below commands to enable PPA to your system.

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

    Once you add the repository, install Node.js by executing the following command.

    sudo apt install nodejs 
    

    Once you complete the installation, run the below command to view the current Node.js version.

    node -v 
    
    Output
    v16.14.0
    

    Conclusion

    You have learned to install Node.js on Ubuntu 20.04. In this tutorial, you found two methods for installing node.js on Ubuntu. Next you may need to install Yarn package manager for Node.js, which have multiple benefits over npm.

    node node.js nvm Ubuntu 20.04
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Create React.js Application on macOS

    How to Install Grunt on Ubuntu 22.04 & 20.04

    How to Install Bower on Ubuntu 22.04 & 20.04

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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