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

    How To Install NVM on Ubuntu 22.04

    By RahulJuly 13, 20223 Mins Read

    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. It also provides an option to auto-select the node version using the .nvmrc configuration file.

    Advertisement

    In this tutorial, we will help you to install NVM on Ubuntu 22.04 Linux system. Also, provide you with the instructions to install multiple Node.js versions with useful examples.

    Prerequisites

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

    Installing NVM on Ubuntu

    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 ~/.profile 
    

    Installing Node using NVM

    You can install any number of node.js versions of your requirements using nvm. Then you can use the required version for your application from installed node.js.

    • Install the latest version of node.js. Here node is the alias for the latest version.
      nvm install node 
      
    • To install a specific version of node:
      nvm install 16.14.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).

    Working with NVM

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

    nvm ls 
    

    List available node.js versions 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

    In this tutorial, you have learned to install nvm on Ubuntu 22.04 LTS (Jammy Jellyfish) Linux system. Also, get a basic understanding of the nvm uses.

    NodeJs nvm Ubuntu 22.04
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to list all collections in MongoDB database

    How to Install Grunt on Ubuntu 22.04 & 20.04

    Running “npm start” with PM2

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Install PHP 8.2-7.4 on RHEL & CentOS Stream 9
    • How to Install MySQL 8.0 on RHEL & CentOS Stream 9
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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