Verification: a143cc29221c9be0

Nalvest ru nv articles detail php

Step 1 – Install NVM

NVM is an command line utility to install and manage Node.js versions for specific users. You can install nvm using a shell script provided by the nvm team.

  1. First, make sure you have curl installed on your system:
    sudo apt update && sudo apt install curl -y
    
  2. Next, run the following command to configure nvm on your system for current logged user.
    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
    
  3. Reload system environment using this command. It will set the required environment variables to use nvm on the system.
    • Debian based systems:
      source ~/.profile 
      
    • CentOS, Fedora and Redhat systems:
      source ~/.bashrc  
      

Step 2 – Find Available Node.js Version

At this point, you have installed nvm on your system for the current user. Now find out the available version of Node.js to install. Use ls-remote option to list versions.

nvm ls-remote 

You will see a long list of available versions.

       ...
       ...
       v14.15.0   (LTS: Fermium)
       v14.15.1   (LTS: Fermium)
       v14.15.2   (LTS: Fermium)
       v14.15.3   (LTS: Fermium)
       v14.15.4   (LTS: Fermium)
       v14.15.5   (LTS: Fermium)
       v14.16.0   (Latest LTS: Fermium)
       ...
       ...
       v15.10.0
       v15.11.0
       v15.12.0

Step 3 – Installing Node.js with NVM

Now install the node.js version you need to use for running node.js application. Below command will install node.js 14.16.0 the LTS release on your system.

nvm install v14.16.0 

You can have also installed the latest version of Node.js.

nvm install v15 

Repeat the above command with the different-2 node.js versions to install multiple versions of node.js on your system.

Step 4 – Set A Default Version

As you have installed multiple node.js versions, You can select the specific version of node.js as default version used by system and load in the environment. Use below command to list currently installed version and default set version.

nvm list 
->     v14.16.0
       v15.12.0
default -> v15 (-> v15.12.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v15.12.0) (default)
stable -> 15.12 (-> v15.12.0) (default)
lts/* -> lts/fermium (-> v14.16.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.0 (-> N/A)
lts/erbium -> v12.21.0 (-> N/A)
lts/fermium -> v14.16.0

You can see that Node.js version v14.16.0 is set as the default version. You can change the default Node.js version. The below command will set 15.12.0 as default Node.js version.

nvm use v15.12.0 

Now verify current active version of node.js

node --version 

v15.12.0

Step 5 – Run Application with Specific Version

If you have multiple node.js applications on your system and want to run each with a specific version of node.js. NVM provides you an option to use a node.js version for running any application. For example

nvm run v14.16.0 app.js 

Step 6 – Remove Unused Node.js Version

This command will provide a list of installed versions of node.js on your system.

nvm list 

You can remove any unused version from your system. Use the following nvm command to remove Node.js version 9.5.0 from your system.

nvm uninstall v9.5.0