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 CentOS/RHEL 8

    How To Install NVM on CentOS/RHEL 8

    By RahulOctober 15, 20203 Mins Read

    NVM stands for Node Version Manager is a command-line utility for managing Node versions. Sometimes you required to deploy multiple node application with different-2 versions. Nvm will help you here.

    Advertisement

    Why NVM ?

    Node Version Manager has multiple benefits, Like:

    • Use nvm to install multiple node versions on single system. Also switch node version any time with single command
    • It allowed users to install any specific node version instead of latest version.
    • The node installed using nvm is for specific user. It create .nvm directory under user home directory and keep everythink inside it

    Installing NVM on CentOS 8

    A shell script is available for the installation of nvm on the CentOS 8 or RHEL 8 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 dnf install curl  
    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash   
    

    This creates a .nvm directory under the home directory. Where nvm keeps own binary file and all other required files. Then it sets environment in users .bashrc file. You need to load this environment to set required configuration by running the following command:

    source ~/.bashrc
    

    Installing Node with NVM

    Nvm allows to install multiple node versions on a single system or the logged in user. Execute below command to view a list of available node versions.

    nvm ls-remote 
    

    Then, install the required node version using the following command.

    nvm install 12.19.0 
    

    Here you change 12.19.0 with your required version like 11.15.0, 10.11.0, etc.

    It also provided alias for the latest stable node version, LTS version and other previous LTS version.

    nvm install node        # Install latest stable version 
    nvm install lts/*       # Install latest lts version 
    

    You can also use lts/dubnium, lts/carbon etc to install other nodejs LTS versions.

    Working with NVM

    Here is some frequently used commands with nvm:

    • List all the installed node versions for the current user
      nvm ls 
      
    • To list all the available version’s for the installation on your system.
      nvm ls-remote 
      
    • Switch to other installed node version for the current session. The new version will be the default version for current shell only
      nvm use 12.19.0
      
    • Find the default Node version set for the current user, type:
      nvm run default --version 
      
    • Run a script file with specific node version using exec option. This will not change the shell version.
      nvm exec 12.19.0 server.js 
      

    Uninstall Specific Node Version with NVM

    You can remove any unused version by running the following command. Just make sure the version you are removing is not currently active version.

    To remove node.js 5.9.0 from your account, type:

    nvm uninstall 5.9.0 
    

    Conclusion

    In this tutorial, you have learned to install nvm and node on CentOS 8 Linux system.

    node nvm
    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.