How to install Node.js and npm using NVM on Ubuntu & Fedora

Node.js is a free and open-source JavaScript runtime environment. Using this you can run or execute your JavaScript code outside of a web browser and run as a standalone application. Npm (Node Package Manager) is the default package manager for Node.js and online database of packages. Using NVM – Node Version Manager, you can easily install and manage single or multiple version of Node.js on your system. This is the recommaned way to install Node.js and npm. Using this method you install NVM, Node.js and npm on any linux distro not only Ubuntu and fedora.

Install Node.js and npm using Node Version Manager NVM

Install NVM:
Open your terminal and run this NVM Node Version Manager installation script.

wget -qO- | bash

Or you can install with cURL

curl -o- | bash

In this script v0.35.3 is nvm version number. you can chnage this based on the latest nvm version.

Close your terminal and open again. Now run this to verify the nvm installation.

nvm --version

Install Node.js and npm:

You can install the latest version of Node.js by running this command.

nvm install node

If you want to install the specific node.js version, use this command first to find the available Node versions.

nvm ls-remote

Then install with this command, if you want to install v12.16.2

nvm install 12.16.2

List the installed node versions. Close and open your terminal and then run.

nvm list

You can set the default Node.js version by running this command. Just chenage below command with your version number.

nvm use v12.16.2

You can verify your default version by this command.

node --version

You can uninstall specific version of node.js by this command. Here i am uninstalling v13.13.0 from my system.

nvm uninstall v13.13.0

npm is comes with node.js. when you download and install Node.js, then you automatically installed npm on your system. you can check the installed npm version with this command.

npm -v

If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.

Also Read:  Spectator API Tester Application

This Post Has 3 Comments

Leave a Reply