DEV Community

Samira Awad
Samira Awad

Posted on

1

How to install Node.js, NPM and NVM on Windows (node version manager)

1. Introduction:
Each language has its own version manager. For Node.js, we use NVM (Node Version Manager), which allows us to work with multiple versions of Node.js in the same environment. This is useful for testing our developments on different versions of Node.js, which is a good practice recommended by both npm and Microsoft.

2. Key Concepts:
NPM: Node.js Package Manager.
NVM: Node.js Version Manager.

3. Preparations:
Before installing NVM, we must ensure that there is no previous version of Node.js installed on our system to avoid conflicts. To check this, run in the terminal:
node -v

4. NVM installation:
• For macOS and Linux: Visit the official NVM repository on GitHub (nvm-sh/nvm).
• For Windows: Download NVM from the following link:

  • Click "Download Now".
  • Download the nvm-setup.zip file.
  • Unzip the file and run the installer.
  • During installation, leave all the default options, since NVM has an update tool that will allow us to easily manage versions.

5.Verify NVM installation:
Once installed, open a new terminal and verify that NVM is correctly installed by running:
nvm

6.Install a version of Node.js:
NVM allows you to install specific versions of Node.js or the latest version. To install the latest recommended version (LTS), run:
nvm install lts

To install others: nvm install version

7.List installed versions of Node.js:
To view the versions of Node.js installed on your system, use:
nvm list

8.Use a specific version of Node.js:
Open a terminal with administrator permissions and choose the version of Node.js you want to use:
nvm use 16.13.1
(Replace 16.13.1 with the version you want.)

9.Check the version of Node.js in use:
To check which version of Node.js is active, run:
node -v
You can also check the current version of Node.js handled by NVM with:
nvm current

10.Uninstall a version of Node.js:
If you want to uninstall a version of Node.js, open the terminal with administrator permissions and run:
nvm uninstall 16.13.1
(Replace 16.13.1 with the version you want to remove.)

11.Installing NPM and Yarn:
When you install Node.js with NVM, npm is installed automatically. To check the npm version, use:
npm -v
If you prefer to use Yarn, install it for each version of Node.js you use:
npm install -g yarn

Conclusion:
With NVM, you can easily manage multiple versions of Node.js on a single system, allowing you to easily test in different environments.

Image description

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay