nvm – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Wed, 13 Jul 2022 08:48:10 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How To Install NVM on Ubuntu 22.04 https://tecadmin.net/how-to-install-nvm-on-ubuntu-22-04/ https://tecadmin.net/how-to-install-nvm-on-ubuntu-22-04/#respond Thu, 07 Apr 2022 02:02:25 +0000 https://tecadmin.net/?p=28843 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. In this tutorial, we will help you to install [...]

The post How To Install NVM on Ubuntu 22.04 appeared first on TecAdmin.

]]>
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.

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.

The post How To Install NVM on Ubuntu 22.04 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-nvm-on-ubuntu-22-04/feed/ 0
How To Install NVM on Windows https://tecadmin.net/install-nodejs-with-nvm-on-windows/ https://tecadmin.net/install-nodejs-with-nvm-on-windows/#respond Fri, 04 Mar 2022 12:05:02 +0000 https://tecadmin.net/?p=24182 NVM (Node Version Manager) is the command-line utility for installing Node.js on your system. It allows us to install multiple Node.js versions and switch between them. This is helpful for the system running multiple Node applications that required different-2 node versions. This tutorial will help you to install and manage multiple Node.js versions on Windows [...]

The post How To Install NVM on Windows appeared first on TecAdmin.

]]>
NVM (Node Version Manager) is the command-line utility for installing Node.js on your system. It allows us to install multiple Node.js versions and switch between them. This is helpful for the system running multiple Node applications that required different-2 node versions.

This tutorial will help you to install and manage multiple Node.js versions on Windows using NVM.

How to Install NVM on Windows

The coreybutler has build the nvm installer for the Windows systems. Visit the below link to download the NVM installer for the Windows systems.

  • https://github.com/coreybutler/nvm-windows/releases
  • And download the nvm-setup.zip file of the latest version.

    How to Install Nvm on Windows
    Download NVM installer for Windows

    Extract the downloaded archive file from your system.

    You will get a node-setup.exe file under the archive file. Double click the node-setup.exe file to begin the Node installation on Windows.

    Follow the installation wizard to complete the installation of Node on Windows.

    How to Install NVM on Windows
    NVM Installation Finished on Windows

    Installing Node.js on Windows using NVM

    As you have already installed the NVM on your system. Now, you can install any version of Node.js on the Windows system. To install the most recent version use “latest” and to install latest stable version use “lts” with nvm install command.

    • Use the following command to install most recent Node.js version
      nvm install latest 
      

      How to Install Latest Node with NVM on Windows
      Installing Latest Node Version on Windows
    • To install the latest stable version, execute the following command
      nvm install lts 
      
    • Installing Latest Stable Node Version on Windows
      Installing Latest Stable Node Version on Windows
    • You can also install a specific version like 14.15.0.
      nvm install 14.15.0 
      

    You can follow the same commands to install multiple node versions on a single system.

    Setup Default Node.js Version

    You can change the default active Node version with the following command. For example, to setup Node 14.1.50 as default version, type:

    nvm use 14.15.0 
    

    Once the new version activated, type:

    node --version 
    

    This will show the current active Node.js version. See the below screenshot:

    How to Install Node.js on Windows
    Setup Default Node Version

    Uninstall Node Version

    You can remove unused older Node version’s from your system with the following command.

    nvm uninstall 14.15.0 
    

    Change the version number as per your requirements. The above command will remove Node 14.15.0 from your system.

    Conclusion

    This tutorial helped you for installing NVM on Windows system. Also provides you commands to install specific Node.js version on Windows system.

    Remember that the NVM is installed for a specific user. So to use NVM for another user, need to separately install it from that account.

    The post How To Install NVM on Windows appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-nodejs-with-nvm-on-windows/feed/ 0
    How To Install Node.Js on Debian 11 https://tecadmin.net/how-to-install-node-js-on-debian-11/ https://tecadmin.net/how-to-install-node-js-on-debian-11/#respond Sun, 19 Sep 2021 06:45:02 +0000 https://tecadmin.net/?p=27794 NodeJs is a JavaScript framework that allows users to easily develop autonomous network applications for general-purpose programming. NodeJs is free to make web application development more uniform and integrated through the use of JavaScript on both the front and back ends. It is available for all Operating Systems; in this article, you will learn how [...]

    The post How To Install Node.Js on Debian 11 appeared first on TecAdmin.

    ]]>
    NodeJs is a JavaScript framework that allows users to easily develop autonomous network applications for general-purpose programming. NodeJs is free to make web application development more uniform and integrated through the use of JavaScript on both the front and back ends.

    It is available for all Operating Systems; in this article, you will learn how to install NodeJs on your Debian system (Linux OS) so that you can build amazing applications using NodeJs.

    Given below are three methods to install NodeJs on Debian 11, you can follow any of these you find easier for successful installation:

    Method 1 – Installing Nodejs from Debian Repository

    At the time of writing this tutorial, the Node.js 12.22.5 version is available under default repositories. To get this version of NodeJs on your Debian system follow the steps mentioned below:

    1. Update Packages – First update all the packages previously installed in the System by below mentioned command:
      sudo apt update 
      
    2. Install Nodejs and NPM – The “npm” is the package manager of NodeJs, run the below mentioned command to install NodeJs and npm on Debian 11:
      sudo apt install nodejs npm 
      
    3. Check Version – To verify the correct version installation of NodeJs, run the below mentioned command to check version number of recently installed NodeJs:
      node -v 
      
      Output:
      v12.22.5

    Method 2 – How to install NodeJs using NodeSource PPA

    You can use a PPA (Personal Package Archive) provided by NodeSource to operate with the latest version of NodeJs. This is an alternative repository containing ‘Apt’ and contains current versions than the official Debian repositories for NodeJs.

    Follow the steps below for successful installation of NodeJs using PPA:

    1. Install PPA – To install NodeJs Package using “Apt”, add the repository to Package list using below-mentioned syntax:

      curl -sL https://deb.nodesource.com/setup_[version_number] -o nodesource_setup.sh

      You can replace “version number” with the version you want to install, here I am installing stable version “16.x” by below mentioned command:

      curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh 
      
    2. Configure NodeSource setup – Run the below mentioned to inquire newly downloaded script, it will open a file and after inspecting the file press Ctrl+X to exit the file and return to terminal:
      nano nodesource_setup.sh 
      
    3. Run the Script – After configuring the script, run the script using below mentioned command:
      sudo bash nodesource_setup.sh 
      

      The PPA is added to your settings and the local package cache is instantly updated.

    4. Install NodeJs – Now after adding PPA, install NodeJs using below mentioned command, we don’t need to install npm separately here as it is already included in package:
      sudo apt install nodejs 
      
    5. Check Version – Now verify installation by checking version number of NodeJs:
      node -v 
      
      Output:
      v16.14.0

      Also check version of npm to verify its installation with NodeJs:

      npm -v 
      
      Output:
      8.3.1
    6. Installing “build-essential” – To get the needy tools to work with npm package, run the below mentioned command:
      sudo apt install build-essential 
      

    Method 3 – Installing NodeJs using NVM on Debian 11

    Node Version Manager, abbreviated as NVM, can also be used to install NodeJs on Debian. Instead of functioning in the operating system, NVM operates in the home directory of your user at the level of an independent directory. In other words, without impacting the overall system, you may install numerous autonomous NodeJs versions.
    You may use NVM to control your environment while maintaining and handling prior releases in the latest NodeJs versions.

    Follow the steps given below to install NodeJs using NVM:

    1. Download NVM installation script – Firstly, from the GitHub link download the nvm installation script by the below-mentioned command:
      curl -sL https://raw.githubusercontent.com/creationix/nvm/master/install.sh -o install_nvm.sh 
      
    2. Configure script – Using nano command, inquire the downloaded script by below mentioned command:
      nano install_nvm.sh 
      

      After checking the file, if everything seems good then exit the editor by pressing Ctrl+X.

    3. Run the script – After configuring the file, run the downloaded script:
      bash install_nvm.sh 
      
    4. Gain Access to NVM Functionality – Running NVM script will add additional setup to “~/ .profile” , allowing the new program, you will either log out or log in back; reload “~/ .profile” file using:
      source ~/.profile 
      
    5. Install NodeJs from available versions on NVM –
      First, we can check which versions of NodeJs are available on NVM by below mentioned command:

      nvm ls-remote 
      

      Now choose the version number you want to install from list, Syntax: nvm install [version-number]

      I am going to install version 16.14.0, so replace [version-number] with 16.14.0:

      nvm install 16.14.0 
      

      In general, the latest version is used by nvm, you need to tell nvm to use the version you downloaded by below mentioned command:

      nvm use 16.14.0 
      
    6. Check Version – You can check the version of NodeJs installed using:
      node -v 
      
      Output:
      v16.14.0

      If you are having many node versions installed on your system, to check recently installed version, run the below mentioned command:

      nvm ls 
      
      Output:
      -> v16.14.0 system default -> 16.14.0 (-> v16.14.0) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v16.14.0) (default) stable -> 16.14 (-> v16.14.0) (default) lts/* -> lts/gallium (-> v16.14.0) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.24.1 (-> N/A) lts/erbium -> v12.22.10 (-> N/A) lts/fermium -> v14.19.0 (-> N/A) lts/gallium -> v16.14.0

    Set Default Version of NodeJs using NVM

    If you want to set any version as default, type the below-mentioned syntax: nvm alias default [version-number]

    I am going to default version v16.14.0 so replace [version-number] with v16.14.0:

    nvm alias default 16.14.0 
    

    Test NodeJs

    We can check whether our installed NodeJs is working or not; make sample JavaScript file using nano command:

    nano sample.js 
    

    The file will be opened in the editor now enter the below-shown content in the file to print “Hello World” on Terminal. Press Ctrl+O to save file and press Ctrl+X to exit file:

    const http = require(‘http’);
    const hostname = ‘localhost’;
    const port = 3000;
    
    const server = http.createServer((req, res) => {
      res.statusCode = 200;
      res.setHeader(‘Content-Type’, ‘text/plain’);
      res.end(‘Hello World\n’);
    });
      server.listen(port, hostname, () => {
      console.log(‘Server running at http://${hostname}:${port}/’);
    });

    Now to start application run below mentioned command:

    node sample.js 
    
    Output:
    Server running at http://localhost:3000

    Run below mentioned command to test application on another terminal:

    curl http://localhost:3000 
    

    How to uninstall NodeJs from Debian 11 Bullseye

    Depending on the version you wish to target, you can remove NodeJs with apt or NVM You will need to deal with the apt program on the system level to uninstall versions installed from the Debian repository or from PPA.
    To uninstall any of version, run the below mentioned command:

    sudo apt remove nodejs 
    

    If you wanted to uninstall version of NodeJs installed from NVM, for that first check the current version of NodeJs installed by below mentioned command:

    nvm current 
    

    Then run the below-mentioned syntax to uninstall any specific version of NodeJs installed using NVM on your system:

    nvm uninstall [version-number]

    I am uninstalling current version of NodeJs, so first I need to deactivate NVM:

    nvm deactivate 
    

    Now run the command:

    nvm uninstall 12.1.0 
    

    Conclusion

    NodeJs is a server-side framework to build JavaScript apps. It is used for both back-end and front-end programming. In this article, we discuss its installation on Debian 11 using three methods which are using Debian’s official Repository, through PPA Repository, and also through NVM and also discuss its testing and uninstallation from the system.

    The post How To Install Node.Js on Debian 11 appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/how-to-install-node-js-on-debian-11/feed/ 0
    How To Install NVM on Debian 11 https://tecadmin.net/how-to-install-nvm-on-debian-11/ https://tecadmin.net/how-to-install-nvm-on-debian-11/#respond Mon, 30 Aug 2021 16:12:01 +0000 https://tecadmin.net/?p=23084 NVM stands for Node Version Manager, which is a command-line utility for installing Node.js. It allows the programmers for installing Node.js in their account only. This means the installation is done user-specific. All the users in a single system have their own installation of Node.js. Using the nvm utility, we can install the multiple node.js [...]

    The post How To Install NVM on Debian 11 appeared first on TecAdmin.

    ]]>
    NVM stands for Node Version Manager, which is a command-line utility for installing Node.js. It allows the programmers for installing Node.js in their account only. This means the installation is done user-specific. All the users in a single system have their own installation of Node.js.

    Using the nvm utility, we can install the multiple node.js versions in a single account and manage them easily. The application can have use .nvmrc at root folder to autoselect the Node.js version.

    This tutorial will help you to install nvm on Debian 11 “bullseye” Linux system.

    Prerequisites

    • Assuming that you have a running Debian 11 Bullseye Linux system with shell access. No need to have sudo access.
    • Login to the system and open a shell in your account
    • The newly installed system are requested to complete initial server setup on Debian 11.

    How to Install NVM on Debian 11

    A shell script is available for the NVM installation on any Linux system. First of all, check if your system has installed the curl command-line utility. If not, use the following command to install curl.

    sudo apt install curl -y 
    

    Then execute the NVM installation bash script as your user. No need to use sudo with the installation script.

    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
    
    Step to Install and Configure NVM on Debian 11

    The above script makes all the required environment settings to the login script of the currently logged-in user. To apply the settings log out and log in again to your account or just execute the below command to do the same.

    source ~/.bashrc
    

    How to Install Node.js on Debian 11

    The nvm allows you to install multiple Node.js versions for a single user account. Use the following commands to install the required node.js version on your Debian 11 system.

    • Install Latest Node Version – This is the most recent version released for the installation by Node.js team. You can use “node” as alias for the latest version.
      nvm install node 
      

      Installing Node.js with NVM
    • Installing Latest Stable Node Version – Use the --lts option with command line to install latest LTS (Long Term Release) version.
      nvm install node --lts 
      
    • To install a specific version of node:
      nvm install 12.20.1  
      

      Change 12.20.1 with your required Node.js version to install on Debian 11 system.

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

    How to Use NVM?

    Here are some useful options to use with the nvm command-line utility.

    You can use the following command to list installed versions of 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. This will be a current active version for the current shell only.

    nvm use 12.20.1 
    

    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 belwo command:

    nvm exec 12.20.1 server.js 
    

    Conclusion

    This tutorial helped you to install nvm on Debian 11 Bullseye Linux system. Additionally provided you the basic instructions to use the NVM utility.

    The post How To Install NVM on Debian 11 appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/how-to-install-nvm-on-debian-11/feed/ 0
    How To Install NVM on macOS with Homebrew https://tecadmin.net/install-nvm-macos-with-homebrew/ https://tecadmin.net/install-nvm-macos-with-homebrew/#comments Tue, 24 Nov 2020 15:48:05 +0000 https://tecadmin.net/?p=23654 The NVM (Node Version Manager) is a shell script used for installing and managing Node.js on a Linux-based system. The macOS users can install NVM using the homebrew. This tutorial helps you to install NVM on your macOS system and manage Node.js versions. Prerequisites You must have macOS desktop access with administrator privileges. Login to [...]

    The post How To Install NVM on macOS with Homebrew appeared first on TecAdmin.

    ]]>
    The NVM (Node Version Manager) is a shell script used for installing and managing Node.js on a Linux-based system. The macOS users can install NVM using the homebrew.

    This tutorial helps you to install NVM on your macOS system and manage Node.js versions.

    Prerequisites

    You must have macOS desktop access with administrator privileges.

    Login to the macOS desktop system and install Homebrew on your system (if not already installed)

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
    

    For more instruction visit Homebrew installation tutorial.

    Step 1 – Remove existing Node Versions

    If your system already has a node installed, uninstall it first. My system already has installed node via Homebrew. So uninstalling it first. Skip if not already installed.

    brew uninstall --ignore-dependencies node 
    brew uninstall --force node 
    

    Step 2 – Install NVM on macOS

    Now, your system is ready for the installation. Update the Homebrew package list and install NVM.

    brew update 
    brew install nvm 
    

    Next, create a directory for NVM at home.

    mkdir ~/.nvm 
    

    Now, configure the required environment variables. Edit the following configuration file in your home directory

    vim ~/.bash_profile 
    

    and, add the below lines to ~/.bash_profile ( or ~/.zshrc for macOS Catalina or newer versions)

    export NVM_DIR=~/.nvm
    source $(brew --prefix nvm)/nvm.sh
    

    Press ESC + :wq to save and close your file.

    Next, load the variable to the current shell environment. From the next login, it will automatically loaded.

    source ~/.bash_profile
    

    That’s it. The NVM has been installed on your macOS system. Go to next step to install Node.js versions with the help of nvm.

    Step 3 – Install Node.js with NVM

    First of all, see what Node versions are available to install. To see available versions, type:

    nvm ls-remote 
    

    Now, you can install any version listed in above output. You can also use aliases names like node for latest version, lts for latest LTS version, etc.

    nvm install node     ## Installing Latest version 
    nvm install 14       ## Installing Node.js 14.X version 
    

    After installing you can verify what is installed with:

    nvm ls 
    

    nvm list node.js macos

    If you have installed multiple versions on your system, you can set any version as the default version any time. To set the node 14.X as default version, simply use:

    nvm use 14 
    

    Similarly, you can install other versions like Node 12, 15, and 18 versions and switch between them.

    Conclusion

    This tutorial explained you to how to install NVM and node.js on the macOS system.

    The post How To Install NVM on macOS with Homebrew appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-nvm-macos-with-homebrew/feed/ 45
    How To Install NVM on CentOS/RHEL 7 https://tecadmin.net/how-to-install-nvm-on-centos-7/ https://tecadmin.net/how-to-install-nvm-on-centos-7/#respond Mon, 23 Nov 2020 16:59:28 +0000 https://tecadmin.net/?p=23077 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. Managing the multiple Node.js versions for differnt-2 projects are a pain for the developers. But NVM helped to easily manage multiple active Node.js versions on a single system. This tutorial [...]

    The post How To Install NVM on CentOS/RHEL 7 appeared first on TecAdmin.

    ]]>
    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.

    Managing the multiple Node.js versions for differnt-2 projects are a pain for the developers. But NVM helped to easily manage multiple active Node.js versions on a single system.

    This tutorial will explain you to install NVM on CentOS/RHEL 7/6 systems and manage multiple Node.js versions.

    Installing NVM on CentOS 7

    NVM provides a simple bash script for the installation on Linux systems. Open a terminal on your system or connect a remote system using SSH.

    Make sure your system have curl installed.

    sudo yum install curl -y 
    

    Then execute the installer script as following command:

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

    Basically, NVM keeps all files under the $HOME/.nvm directory. 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.js using NVM

    Nvm allows to install multiple node versions on your system for the logged in user. You can find all the available Node version for installation by running command:

    nvm ls-remote 
    

    Above command will show you a list of available node versions. Now you can install any node version by typing:

    nvm install 12.19.1 
    

    Just change 12.19.1 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.

    Using NVM

    You can use the following command to list installed versions of 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 12.18.3 
    

    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 12.18.3 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.8.0, type:

    nvm uninstall 5.8.0 
    

    Conclusion

    This tutorial helped you to install nvm and node on Fedora Linux system. You also learned about basics of nvm command line utility.

    The post How To Install NVM on CentOS/RHEL 7 appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/how-to-install-nvm-on-centos-7/feed/ 0
    How To Install NVM on Debian 9 https://tecadmin.net/how-to-install-nvm-on-debian-9/ https://tecadmin.net/how-to-install-nvm-on-debian-9/#respond Sat, 07 Nov 2020 18:32:33 +0000 https://tecadmin.net/?p=23082 NVM is a command-line version manager for the Node.js programming language. With the help of nvm utility, you can install multiple node.js versions on a single machine. You can also choose specific Node version for applications. You can also create an .nvmrc configuration file to auto select Node version. This tutorial help you to install [...]

    The post How To Install NVM on Debian 9 appeared first on TecAdmin.

    ]]>
    NVM is a command-line version manager for the Node.js programming language. With the help of nvm utility, you can install multiple node.js versions on a single machine. You can also choose specific Node version for applications.

    You can also create an .nvmrc configuration file to auto select Node version.

    This tutorial help you to install NVM on your system and managing multiple Node.js version.

    Prerequisites

    • A running Debian 9 Linux system with shell access.
    • Login with a user account to which you need to install Node.js.

    Installing NVM on Debian

    Use a shell script to install and configure NVM on your Debian system. Download the shell script from Github and execute on your system.

    Also, you can download and run this script in single command. Open a terminal and execute below commands.

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

    Above script makes all the required environment settings to login script of current logged in user. To apply the settings logout and login again to account or just execute below command to do the same.

    source ~/.profile   
    

    Installing Node using NVM

    You can install multiple Node.js versions using nvm. And use 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 12.18.3  
    

    You can choose any other version to install using above command. The very first version installed becomes the default. New shells will start with the default version of node (e.g., nvm alias default).

    Working with NVM

    You can use the following command to list installed version’s of Node for the current user.

    nvm ls 
    

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

    nvm ls-remote 
    

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

    nvm use 12.18.3 
    

    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 belwo command:

    nvm exec 12.18.3 server.js 
    

    Conclusion

    This tutorial explained how to install nvm on Debian 9 Linux system.

    The post How To Install NVM on Debian 9 appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/how-to-install-nvm-on-debian-9/feed/ 0
    How To Install NVM on Amazon Linux https://tecadmin.net/install-nvm-on-amazon-linux/ https://tecadmin.net/install-nvm-on-amazon-linux/#respond Sun, 01 Nov 2020 16:39:28 +0000 https://tecadmin.net/?p=23080 NVM or Node Version Manager is a command-line utility for installing and managing multiple node.js versions on Linux based systems. With the help of NVM, you can install any specific nodejs version on your system and use to run your application. This tutorial will help you to install NVM on your Amazon Linux machine. Also [...]

    The post How To Install NVM on Amazon Linux appeared first on TecAdmin.

    ]]>
    NVM or Node Version Manager is a command-line utility for installing and managing multiple node.js versions on Linux based systems. With the help of NVM, you can install any specific nodejs version on your system and use to run your application.

    This tutorial will help you to install NVM on your Amazon Linux machine. Also helped you to basic uses of NVM for Amazon Linux systems.

    Prerequisites

    A running Amazon Linux system with shell access. Login to your Amazon Linux system via SSH.

    Step 1 – Installing NVM

    Node Version Manager official team provides a shell script for the installation of NVM command line utility. Use the following commands to install NVM on Amazon Linux system:

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

    This will create a .nvm directory under the logged in user home directory. NVM keeps all the binaries and configuration files under this .nvm directory.

    Logout and login with your user account to load nvm environment or use the following command to load environment without login again.

    source ~/.bashrc
    

    At this stage, you have successfully install NVM on your system.

    Step 2 – Installing Node using NVM

    NVM allowed users to install multiple node.js versions for each user account. First of all, use the following command to find all available versions of node.js for installation:

    nvm ls-remote 
    

    Above command will show you a list of available node versions. Now you can install any node version by typing:

    nvm install 12.19.0 
    

    Just 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.

    Step 3 – Working with NVM

    You can use the following command to list installed versions of 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 12.19.0 
    

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

    nvm run default --version 
    

    When you have multiple node.js version installed, You can choose specific version to run any script:

    nvm exec 12.19.0 server.js 
    

    Step 4 – 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 10.12.0, type:

    nvm uninstall 10.12.0 
    

    Conclusion

    This tutorial helped you to install and use NVM on Amazon Linux system. Also, you learned about basic uses nvm command line utility.

    The post How To Install NVM on Amazon Linux appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-nvm-on-amazon-linux/feed/ 0
    How To Install NVM on CentOS/RHEL 8 https://tecadmin.net/install-nvm-centos-8/ https://tecadmin.net/install-nvm-centos-8/#respond Thu, 15 Oct 2020 15:46:34 +0000 https://tecadmin.net/?p=23076 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. Why NVM ? Node Version Manager has multiple benefits, Like: Use nvm to install multiple node versions on single system. Also switch node version any [...]

    The post How To Install NVM on CentOS/RHEL 8 appeared first on TecAdmin.

    ]]>
    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.

    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.

    The post How To Install NVM on CentOS/RHEL 8 appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/install-nvm-centos-8/feed/ 0
    Using .nvmrc to Specify Node Version https://tecadmin.net/lock-application-with-specific-node-version/ https://tecadmin.net/lock-application-with-specific-node-version/#respond Wed, 16 Sep 2020 18:36:56 +0000 https://tecadmin.net/?p=22585 You can lock your application with a specific node.js version. This will help you to isolate the dependencies of of your node.js application. So you can quickly install required packages on any system. In this tutorial, you will learn a simple process of specifying node.js version using .nvmrc file. Using .nvmrc Create a .nvmrc file [...]

    The post Using .nvmrc to Specify Node Version appeared first on TecAdmin.

    ]]>
    You can lock your application with a specific node.js version. This will help you to isolate the dependencies of of your node.js application. So you can quickly install required packages on any system.

    In this tutorial, you will learn a simple process of specifying node.js version using .nvmrc file.

    Using .nvmrc

    Create a .nvmrc file containing a node version number in your project. You can use the nvm —-help to check other options. After that you can simply run commands like nvm use, nvm install and nvm run etc. This will the default node.js version defined in .nvmrc file.

    For example, to make nvm default to use 12.10, or the latest LTS version, or the latest available node version. Use once of the below commands.

    1. Use specific node version, like: 12.10
      echo "12.10" > .nvmrc 
      
    2. Set latest LTS node version as default
      echo "lts/*" > .nvmrc 
      
    3. Set latest node version as default
      echo "node" > .nvmrc 
      

    After setting the default node version, use nvm use command to set default node version found in .nvmrc. Similarly if specified node version is not installed simply run nvm install.

    nvm use
    nvm install
    

    The above commands will traverse directory structure upwards from the current directory looking for the .nvmrc file. In other words, once you set the node version with .nvmrc, can run nvm commands from any sub directory of the application.

    The post Using .nvmrc to Specify Node Version appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/lock-application-with-specific-node-version/feed/ 0