How to install particular version of Node JS and npm using NVM

Date: 17-04-2021

Introduction

NVM (Node Version Manager) is a bash script that allows you to manage multiple Node JS versions. You can easily switch to other versions.

Step 1: You can install nvm by using below command.
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

Step 2: Once installation is completed you will close and reopen your server by terminal.

Step 3: Use below command to get a list of all Node.js versions available in nvm.
# nvm list-remote

Step 4: Use below command to install the particular version of Node.js.
# nvm install node 12.20.0

Note: If you want to install latest version of Node.js, you can use below command.
# nvm install node

Step 5: To check node and npm version
# node --version
# npm --version

Note: If you want to change the current active node version, you can use below command.
# nvm use 12.16.3 ——-> 12.16.3 is another version.

Leave a Reply