Open In App

How to Install Node.js on Windows

Last Updated : 06 Jan, 2025
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

Installing Node.js on Windows is a straightforward process, but it’s essential to follow the right steps to ensure smooth setup and proper functioning of Node Package Manager (NPM), which is crucial for managing dependencies and packages. This guide will walk you through the official site, NVM, Windows Subsystem, and Package Manager for Windows 7, 8, 10, and 11.

Prerequisites for Installing Node.js on Windows:

  • Windows OS: Windows 7 or later
  • Administrator Rights: Required for installation
  • Internet Connection: Stable connection for downloading
  • Windows Installer: Latest version for smooth installation
  • Text Editor/IDE: Visual Studio Code or similar
  • Basic Command Line Knowledge: CMD or PowerShell familiarity
  • Disk Space: At least 100 MB of free space
  • Hardware Requirements: Minimum 2 GB RAM and 1 GHz processor

Method 1: Use the Official Website

Follow these steps to install the Node.js on your Windows:

Step 1: Download Node.js Installer

  • Visit the official Node.js websiteto download the Node.js ‘.msi’ installer
Download-Node

Download NodeJS

  • Download the Windows Installer based on your system architecture (32-bit or 64-bit)

The LTS (Long Term Support) version is recommended for most users since it is more stable, whereas the Current version includes the latest features but may have more frequent updates.

Step 2: Run the Installer

  • Locate the downloaded .msi file and double-click to run it.
  • Follow the prompts in the setup wizard, accept the license agreement, and use the default settings for installation.
  • Select features to install such as:
    • npm: to manage packages for Node.js applications
    • Native modules: for building native C++ modules

Step 3: Finish Setup and Install Node.js and NPM

The installer may prompt you to “install tools for native modules”. Select “Install” to complete the process.

finish-setup

Finish the setup

Wait for “Finish” to complete the setup.

Installation

Nodejs Installation

Step 4: Verify the Installation

Open Command Prompt or PowerShell > Check the installed versions by running these commands:

  • Type node -v and press Enter to check the Node.js version.
  • Type npm -v and press Enter to check the npm version.
  • Both commands should return version numbers, confirming successful installation.
C:\Users\Admin> node -v

Note:You can run the following command, to quickly update the npm

npm install npm --global // Updates the ‘CLI’ client

Method 2: Install Node.js using NVM

Node Version Manager or nvm-windows allows users to manage different versions of node.js Here’s how you can do it:

Step 1: Install NVM for Windows

Download the latest NVM for Windows installer from the GitHub page. Now run the installer and follow the setup instructions.

nvm2

Node.js

Step 2: Install Node.js and NPM

Either you can run the downloaded installer manually and follow the on-screen instructions or run the following command in CMD or PowerShell:

nvm install latest
cmd2

Run the command

Note: You can also specify the node.js version by using “nvm install 14.17.6″ or you can choose any installed version as a default by using “nvm use 14.17.3″

Step 3: Verify Node Installation

To check the installed version of Node.js, run the following command:

node -v

Note: You can use a specific versions by using – nvm use 14.17.6

node2

Node

Method 3: Use Windows Subsystem (WSL)

Windows Subsystem for Linux (WSL) is a great option for those who prefer a Linux environment. You can run a Linux distribution on your Windows machine and use Linux tools like apt-get for installation.

Step 1: Open PowerShell

Open PowerShell as Administrator and run the following command:

wsl91

Open Powershell

This will install the WSL feature and the default Ubuntu distribution.

Step 2: Set up a Linux Distribution

Once WSL is installed, launch the Ubuntu (or another Linux distro) app from the Start Menu and set up your Linux distribution by creating a user and password.

wslinstall

WSL

Step 3: Install Node.js and NPM via apt

Open the WSL terminal (Ubuntu or your chosen distribution) and update your package list:

sudo apt update
sudo2

sudo

Once the update is done, Install Node.js using the following command:

sudo apt install nodejs
sudo apt install npm

Step 4: Verify Node.js and NPM Installation

Once the installation is complete, verify the installation by entering the following command:

node -v
npm -v
version2

verify

Note: You can also use nvm (Node Version Manager) within WSL to manage multiple versions of Node.js. Install it with: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

Method 4: Install Node.js & NPM using WPM

Windows 10 and 11 users can use winget, the Windows Package Manager, to easily install Node.js.

Step 1: Open PowerShell as Administrator

Right-click on the Start Menu and select Windows PowerShell (Admin).

shd

Windows PowerShell Admin

Step 2: Run the Installation Command

Use the following command to install Node.js:

winget install OpenJS.NodeJS
0shd

Run the install command

Step 3: Verify Installation for Node.js and NPM

After installation, check if Node.js is installed correctly:

node -v
npm -v
version

verify

Master Full Stack Development with the React & Node JS Course

Conclusion

Installing Node.js and NPM on Windows is crucial for developers working in JavaScript and server-side applications. Whether you choose to install Node.js using the official installer, Chocolatey, or NVM for Windows, these methods will ensure that you have a fully functional Node.js environment.

By managing your packages with NPM, you can streamline your development process and maintain your projects efficiently.

How to Install Node.js and NPM on Windows – FAQs

How do I install Node.js on Windows 10?

Step 1: Go to the official Node.js website: nodejs.org.

Step 2: Click on the “LTS” version to download the Windows installer.

Step 3: Run the downloaded .msi file.

Step 4: Follow the installation wizard and accept the default settings.

Step 5: Once installed, open Command Prompt and type node -vto verify the installation.

How can I verify if Node.js is installed on my Windows system?

Step 1: Open Command Prompt (press Windows + R, type cmd).

Step 2: Typenode -vand press Enter.

Step 3: If Node.js is installed, it will display the version number.

How do I install Node.js on Windows using CMD?

Step 1: Open Command Prompt as Administrator.

Step 2: Download the installer from nodejs.org.

Step 3: Run the installer with the command: start node-vX.X.X-x64.msi

Step 4: Follow the installation steps in the wizard.

What is the difference between Node.js and npm?

  • Node.js is a JavaScript runtime used to execute JavaScript code outside the browser,
  • While npm is a package manager used to manage and install dependencies for Node.js projects.

Does Node.js come with npm?

Yes, npm come with Node js. You may verify the installation with the help of the following command:

C:\> npm -v
2.11.3

How do I uninstall Node.js from Windows?

Step 1: Open Control Panel > Programs > Programs and Features.

Step 2: Find Node.js in the list and click Uninstall.

Step 3: Follow the uninstallation prompts.

How to install Node.js in local?

Below are three simple steps to install Node js in local:

  • Firstly, create a server and start a new project following the server file
  • Start Running the server by node server.js
  • Now press Ctrl+C to stop the server


Next Article

Similar Reads

three90RightbarBannerImg