How to Install Node.js and NPM on Your Windows System (2024)

Introduction

Node.js is a runtime environment that includes everything you need to execute a program written in JavaScript. It's used for running scripts on servers to render content before it is delivered to a web browser.

Node Package Manager (NPM) is an application manager and repository for developing and sharing JavaScript code. It enables managing Node.js dependencies.

This guide shows several methods to install and test Node.js and NPM on Windows.

How to Install Node.js and NPM on Your Windows System (1)

Prerequisites

  • A user account with administrator access (or the ability to download and install software).
  • Access to the command prompt.
  • A text editor or IDE to run code and test Node.js.

Note: To install Node.js on different operating systems, check out our guides:

  • Installing Node.js and NPM on CentOS 7
  • How to Install Node.js on Debian
  • How to Install Node.js and NPM on Mac

Install Node.js and NPM on Windows via Node.js Installer

If you prefer using the GUI to install programs, Node.js has a downloadable installer on their official website. Follow the steps below to install Node.js and NPM on Windows via the installer.

Step 1: Download Node.js Installer

In a web browser, navigate to the Node.js Downloads page. Click the Windows Installer button to download the latest stable version with long-term support (LTS). The installer also includes the NPM package manager.

How to Install Node.js and NPM on Your Windows System (2)

The file is saved in the Downloads folder by default.

Other versions of Node.js and NPM are available, so choose the appropriate one for your system and use case. Use the top tabs to switch from the LTS to the current version to test the newest features. If you are new to Node.js or don't need a specific version, choose LTS since it is tested and stable.

Step 2: Install Node.js and NPM

After downloading the installer, follow the steps below:

1. Launch the installer by double-clicking the downloaded file.

2. The Node.js Setup Wizard starts with the welcome screen.

Click Next to proceed.

4. Review the end-user license agreement and click the checkbox to accept the terms and conditions.

How to Install Node.js and NPM on Your Windows System (4)

Click Next to continue.

5. The installer asks to choose the installation location.

How to Install Node.js and NPM on Your Windows System (5)

Leave the default location for a standard installation and click Next to proceed.

6. Select components to include or remove from the installation. The default options install Node.js, NPM, corepack, online documentation shortcuts, and add the programs to PATH.

How to Install Node.js and NPM on Your Windows System (6)

Customize the setup or click Next to accept the default values.

7. The following section shows the total required space for the installation and the available space on disk.

How to Install Node.js and NPM on Your Windows System (7)

Click OK to proceed. Select a different disk or install fewer features if the installation does not allow proceeding.

8. Choose whether to install additional dependencies for compiling native modules. Some NPM modules compile from C/C++ and require additional tools to function correctly (Python, Visual Studio Build Tools, and Chocolatey).

How to Install Node.js and NPM on Your Windows System (8)

If you use such modules, select the checkbox and click Next. The selection of this option starts an installation script after the Node.js installation is complete.

For a simple installation, skip this step and click Next to proceed.

7. Click the Install button to start the installation.

How to Install Node.js and NPM on Your Windows System (9)

8. The installer prompts for administrator confirmation to make changes to the device.

How to Install Node.js and NPM on Your Windows System (10)

Enter the administrator password if prompted and click Yes to continue.

9. The installation takes some time. When it is complete, the final screen shows a success message.

How to Install Node.js and NPM on Your Windows System (11)

Click Finish to complete the installation and close the installer.

Note: If you selected to install native tools in step 8, closing the installer automatically starts a PowerShell script to install the listed tools.

Step 3: Verify Installation

To verify Node.js installed successfully, run the following command in a command prompt or PowerShell:

node -v

The command shows the Node.js version installed on your system. Use the following command to check for NPM:

npm -v
How to Install Node.js and NPM on Your Windows System (12)

Note: If NPM is not recognized or properly installed, command prompt displays the following error message: npm: command not found. Check if NPM is added to path, or if there are multiple versions installed on the system.

Install Node.js and NPM on Windows via Chocolatey

Chocolatey is a Windows package manager. It can be used to install programs such as Node.js with NPM. Follow the steps below to install Node.js and NPM using Chocolatey.

Note: Chocolatey is not available on Windows by default. If you need to install it, follow our guide to install Chocolatey on Windows.

Step 1: Install Node.js and NPM

To run the installation command, do the following:

1. Open the command prompt as an administrator.

2. Run the following command to install Node.js and NPM:

choco install nodejs
How to Install Node.js and NPM on Your Windows System (13)

When prompted to run the installation script, press y and Enter to continue the installation. Wait for the installation to complete before proceeding.

3. Reset environment variables to add Node.js and NPM to PATH. Use the following command:

refreshenv
How to Install Node.js and NPM on Your Windows System (14)

The command resets the environment variables, which enables running both programs from the terminal.

Step 2: Verify Node.js and NPM installation

To verify that Node.js is installed correctly, run the following command in a new command prompt session:

node -v

Check the NPM installation with:

npm -v

Both commands display the program version.

Test Node.js Installation

There are several ways to test a Node.js installation. The simplest way is to create a Hello World JavaScript program and run it using Node.js:

1. Open a text editor or IDE.

2. Add the following code to the file:

console.log("Hello, world!")

The code is a simple program that prints "Hello, world!" to the console.

3. Save the script with a .js extension.

4. Run the program from an IDE to see the results. Alternatively, navigate to the directory where the file is located and use the following command:

node [file_name].js
How to Install Node.js and NPM on Your Windows System (15)

The command prints the message to the console, indicating that the Node.js installation works successfully.

Conclusion

You should now be able to install the Node.js framework and the NPM package manager. You also wrote your first Node.js JavaScript program.

Next, see the differences betweenYarn and NPM, two different Node.js package managers.

How to Install Node.js and NPM on Your Windows System (2024)

FAQs

How to Install Node.js and NPM on Your Windows System? ›

Download the nvm-setup.zip file for the most recent release. Once downloaded, open the zip file, then open the nvm-setup.exe file. The Setup-NVM-for-Windows installation wizard will walk you through the setup steps, including choosing the directory where both nvm-windows and Node.js will be installed.

How to install Node.js and npm on Windows? ›

Download the nvm-setup.zip file for the most recent release. Once downloaded, open the zip file, then open the nvm-setup.exe file. The Setup-NVM-for-Windows installation wizard will walk you through the setup steps, including choosing the directory where both nvm-windows and Node.js will be installed.

How do I add npm and node to path in Windows? ›

To set the PATH for node. js and npm follow these steps:
  1. Step 2: Search for environment variables in the global search.
  2. Step 3: Click Environment Variables.
  3. Step 4: On System Variables, select Path and click edit.
  4. Step 6: Reload your terminal window and now it should be fixed.
Apr 4, 2024

Does installing Node.js also install npm? ›

NPM is included with Node. js installation. After you install Node. js, verify NPM installation by writing the following command in terminal or command prompt.

How to install npm in terminal? ›

To install a package, npm uses the following algorithm:
  1. load the existing node_modules tree from disk.
  2. clone the tree.
  3. fetch the package.json and assorted metadata and add it to the clone.
  4. walk the clone and add any missing dependencies.
  5. dependencies will be added as close to the top as is possible.
Sep 22, 2020

How to check if npm is installed or not? ›

To see if NPM is installed, type npm -v in Terminal. This should print the versionnumber so you'll see something like this 1.4.

How to run Node.js with npm? ›

Installation of NodeJS and NPM is straightforward using the installer package available at NodeJS official web site.
  1. Download the installer from NodeJS WebSite.
  2. Run the installer.
  3. Follow the installer steps, agree the license agreement and click the next button.
  4. Restart your system/machine.

Which path to run npm install? ›

You should run it in your project root folder, or the folder above your node_modules folder as sometimes the structure can differentiate between projects. But in general: the root folder of your project, as long as it is one folder above your node_modules.

Does npm install work on Windows? ›

Click the Windows Installer button to download the latest stable version with long-term support (LTS). The installer also includes the NPM package manager. The file is saved in the Downloads folder by default. Other versions of Node.js and NPM are available, so choose the appropriate one for your system and use case.

Can I install Node.js without npm? ›

Yes. The Node installer ships with npm, but the actual download for Node only contains the Node runtime, not npm (which can be downloaded separately). NVM for Windows downloads Node and npm separately, meaning you don't have to use npm. Node is pretty powerful on its own, but it's also pretty low-level.

Do we need to install npm separately? ›

If NPM is not installed or is outdated, you can install it separately or update it by running the command npm install -g npm in the terminal. This will update NPM to the latest version. To verify the NPM installation, type npm -v in the terminal. It should display the latest version of NPM.

How to install Node.js and npm in Windows 11? ›

How to Install Node.js and NPM on Windows?
  1. Step 1: Download the Installer. Download the Windows Installer from NodeJs official website. ...
  2. Step 2: Install Node.js and NPM. After choosing the path, double-click to install .msi binary files to initiate the installation process. ...
  3. Step 3: Check Node.js and NPM Version.
Feb 14, 2024

What does npm stand for? ›

npm stands for Node Package Manager. It's a library and registry for JavaScript software packages. npm also has command-line tools to help you install the different packages and manage their dependencies. npm is free and relied on by over 11 million developers worldwide. You could say it's kind of a big deal.

How to run Node.js in cmd? ›

The usual way to run a Node.js program is to run the globally available node command (once you install Node.js) and pass the name of the file you want to execute. While running the command, make sure you are in the same directory which contains the app.js file.

How to install nvm and npm on Windows? ›

Installing nvm on Windows
  1. Download the latest version of NVM for Windows. ...
  2. Open the terminal and run the nvm list available command to see a list of Node versions that are available to download and install.
  3. Run the nvm use command, followed by the version number of Node you want to use (e.g. nvm use 16.9.
Jan 20, 2022

How to install Node.js and npm in non admin access Windows machines? ›

How to set up
  1. Create a folder in any path you want. ...
  2. Move node.exe from step 2 to the folder you created.
  3. Move npm.cmd from step 2 to the folder you created.
  4. Move npm_modules/npm from step 2 to the folder you created.
  5. Open the “Run” dialog.
  6. Types rundll32 sysdm.cpl,EditEnvironmentVariables into Run dialog and execute.
Sep 24, 2023

Top Articles
Do you need life insurance during retirement?
Venture Capitalist Attributes and Investment Vehicles: An Exploratory Analysis
Walgreens Harry Edgemoor
Bubble Guppies Who's Gonna Play The Big Bad Wolf Dailymotion
Mountain Dew Bennington Pontoon
Archived Obituaries
Txtvrfy Sheridan Wy
10000 Divided By 5
Riegler & Partner Holding GmbH auf LinkedIn: Wie schätzen Sie die Entwicklung der Wohnraumschaffung und Bauwirtschaft…
Tiraj Bòlèt Florida Soir
Urban Dictionary Fov
4156303136
Alexandria Van Starrenburg
Www Craigslist Com Phx
Inside the life of 17-year-old Charli D'Amelio, the most popular TikTok star in the world who now has her own TV show and clothing line
Zalog Forum
Where Is The Nearest Popeyes
Craigslist List Albuquerque: Your Ultimate Guide to Buying, Selling, and Finding Everything - First Republic Craigslist
I Saysopensesame
Melendez Imports Menu
Wics News Springfield Il
8000 Cranberry Springs Drive Suite 2M600
Bn9 Weather Radar
Keyn Car Shows
R Baldurs Gate 3
Afni Collections
Ascensionpress Com Login
Riverstock Apartments Photos
Die wichtigsten E-Nummern
Transformers Movie Wiki
Ff14 Laws Order
Home Auctions - Real Estate Auctions
Melissa N. Comics
Hotel Denizen Mckinney
Mbi Auto Discount Code
Murphy Funeral Home & Florist Inc. Obituaries
M3Gan Showtimes Near Cinemark North Hills And Xd
Hisense Ht5021Kp Manual
Quake Awakening Fragments
Enjoy4Fun Uno
Captain Billy's Whiz Bang, Vol 1, No. 11, August, 1920
America's Magazine of Wit, Humor and Filosophy
Oxford House Peoria Il
Craigslist Ludington Michigan
ESA Science & Technology - The remarkable Red Rectangle: A stairway to heaven? [heic0408]
Cocorahs South Dakota
Lucifer Morningstar Wiki
Lucyave Boutique Reviews
Tfn Powerschool
Uc Davis Tech Management Minor
Buildapc Deals
Karen Kripas Obituary
Latest Posts
Article information

Author: Van Hayes

Last Updated:

Views: 6191

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.