Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Windows 10 / How to Install Node.js and NPM (Package Manager) on Windows

November 12, 2024 Windows 10Windows 11Windows Server 2022

How to Install Node.js and NPM (Package Manager) on Windows

Node.js is a cross-platform runtime for running server-side (back-end) JavaScript apps outside the browser. This guide describes how to install the Node.js framework and the Node Package Manager (NPM) on Windows.

The official website (https://nodejs.org/en/download/prebuilt-installer) provides an MSI installer for Node.js and NPM. If there are no specific requirements, it is usually recommended to install the LTS (Long Term Support) version of Node.js.

Download the node.js installer for Windows

Run the installation from the MSI package with the default settings.

Install the Node.js with npm package manager on Windows

The MSI package contains not only the Node.js framework itself but also the NPM package manager, which is installed by default. The installer will automatically add the paths to the Node.js and NPM directories to the Windows environment variables.

The built-in Node Package Manager (NPM) is used to download, install, and manage the dependencies of third-party modules and projects from external repositories.

Compiling some of the modules installed via npm may require Python and Visual Studio. You can either let NPM install the required tools automatically via Chocolatey, or install them manually later (https://github.com/nodejs/node-gyp#on-windows).

Automatically install tools for native modules in node.js

Once the installation is complete, check that Node.js and npm are installed. Run the following commands to check the tool versions:

node -v
npm -v

node -v - check version and if the node js is installed on windows

It is also possible to install Node.js. using the WinGet package manager (installed by default on Windows 10/11).

winget install OpenJS.NodeJS.LTS

Install OpenJS.NodeJS.LTS with winget command

This command will automatically download the latest LTS version of Node.js and silently install it.

Restart the cmd/powershell console to update the paths in the environment variables. Check that node.js and NPM have been successfully installed and that the paths to them have been added to the PATH environment variable:

(Get-ChildItem env:Path).value -split ";"

Add node.js and npm path to environment variables

C:\Program Files\nodejs\
C:\Users\%username%\AppData\Roaming\npm

Or install the Node.js on Windows using the Chocolatey package manager:

Choco install -y nodejs.install

You can use a simple JavaScript script to test how Node.js works. Create a text file hello.js containing the code:

console.log("Hello, world!")

Run the JS script using node.js:

node hello.js

run hello world JS file with node.js on Windows

For server deployments, it is recommended to use the NVM (Node Version Manager) to install Node.js and npm.

NVM allows developers to have multiple Node.js versions installed on a computer and to switch between them. NPM also doesn’t use the current user’s profile to store temp and app data, unlike the Node.js version in the MSI installer. This eliminates problems with paths and permissions when launching Node JS-based services.

The easiest way to install NPM is to use the NVM for Windows package ( https://github.com/coreybutler/nvm-windows). Download the nvm-setup.exe file and run the installation.

Install NVM for Windows - Node.js version manager for Windows

To install a specific version of Node.js using NVM, run:

nvm install 21

List installed Node versions:

nvm list

Switch between NodeJS versions:

nvm use 20.11.0

When switching versions, the nvm script replaces the path to the Node.js version in the PATH variable.

0 comment
1
Facebook Twitter Google + Pinterest
previous post
Remove a Specific Device from the Safely Remove Hardware List on Windows
next post
Network Monitor: Capture and Analyze Network Traffic on Windows

Related Reading

Configure NTP Time Source for Active Directory Domain

May 6, 2025

How to Cancel Windows Update Pending Restart Loop

May 6, 2025

View Windows Update History with PowerShell (CMD)

April 30, 2025

Cannot Install Network Adapter Drivers on Windows Server

April 29, 2025

Change BIOS from Legacy to UEFI without Reinstalling...

April 21, 2025

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025
  • How to Write Logs to the Windows Event Viewer from PowerShell/CMD

    March 3, 2025
  • How to Hide (Block) a Specific Windows Update

    February 25, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Allow Multiple RDP Sessions on Windows 10 and 11
  • How to Run Program without Admin Privileges and Bypass UAC Prompt
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows
  • Fixing ‘The Network Path Was Not Found’ 0x80070035 Error Code on Windows
  • How to Delete Old User Profiles in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • How to Backup and Copy Local Group Policy Settings to Another Computer
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top