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 22.10 & 21.10

    How to Install Node.js on Ubuntu 22.10 & 21.10

    By RahulDecember 15, 20223 Mins Read

    Node.js is the popular language for front-end programming. A number of JavaScript frameworks are available for quick-build mobile and web application development.

    Advertisement

    NVM is a Node Version Manager tool. Using the NVM utility, you can install multiple node.js versions on a single system. You can also choose a specific Node version for applications.

    This tutorial described how to install node.js on Ubuntu 22.10 and 21.10 systems using NVM.

    Prerequisites

    • A running Ubuntu Linux system with shell access.
    • Log in with a user account to which you need to install node.js.

    Step 1 – Install NVM

    A shell script is available for the installation of nvm on the Ubuntu system. Use the following commands to install curl on your system, then run the nvm installer script.

    Open a terminal on your system and execute:

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

    The script will create the necessary environment variables in the login script of the current user. You can either log out and log in again to load the environment or use the following to load the environment.

    source ~/.profile   
    

    Step 2 – Install Node.js on Ubuntu

    The NVM allows you to install and manage multiple node.js versions for each user account on a Linux system. You can easily switch to the specific version anytime.

    1. To install the latest node.js version, type:
      nvm install node 
      
    2. To install the latest LTS version of node, type:
      nvm install lts  
      
    3. To install a specific version of node, type:
      nvm install 16.4.0  
      

      You can choose any other version to install using the above command.

    The very first version installed becomes the default. New shells will start with the default version of the node (e.g., nvm alias default).

    Step 3 – Other Useful commands

    You can use the following command to list installed versions of the node for the current user.

    nvm ls 
    

    With this command, you can find the available node.js version for the installation.

    nvm ls-remote 
    

    You can also select a different version for the current session. The selected version will be the currently active version for the current shell only.

    nvm use 16.14.0 
    

    To find the default Node version set for the current user, type:

    nvm run default --version 
    

    You can run a Node script with the desired version of node.js using the below command:

    nvm exec 16.14.0 server.js 
    

    Conclusion

    This tutorial described you to install node.js on Ubuntu 22.10, and 21.10 Linux systems using Node Version Manager.

    node NodeJs
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Create React.js Application on macOS

    How to list all collections in MongoDB database

    How to Install Grunt on Ubuntu 22.04 & 20.04

    View 1 Comment

    1 Comment

    1. Carla Rosa on August 17, 2021 4:51 am

      Thank you! the installation worked very well.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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