Node.js is a JavaScript runtime that lets you run JavaScript outside the browser, enabling server-side development, build tools, command-line utilities, and much more. npm (Node Package Manager) comes bundled with Node.js and provides access to over two million open-source packages. This guide walks you through installing both on Windows, verifying your setup, managing multiple versions, and initializing your first project.
What Is Node.js?
Node.js is built on Chrome's V8 JavaScript engine. It uses an event-driven, non-blocking I/O model that makes it efficient for building scalable network applications. In 2026, Node.js powers a huge portion of the web development ecosystem, including frameworks like Express, Next.js, Nuxt, and Astro, as well as build tools like Vite and webpack.
Even if you primarily write front-end code, you need Node.js installed because modern development workflows rely on npm packages for everything from CSS preprocessing to testing and deployment.
What Is npm?
npm is the default package manager for Node.js. It lets you install, update, and manage third-party libraries (called packages) for your projects. When you install Node.js, npm is included automatically. There is also an alternative package manager called pnpm and another called Yarn, but npm is the standard starting point.
LTS vs. Current: Which Version to Choose?
The Node.js downloads page at nodejs.org offers two release tracks:
- LTS (Long Term Support) – Recommended for most users. LTS releases receive bug fixes and security updates for 30 months. As of 2026, Node.js 22 LTS is the active LTS version. Choose this for production applications and stable development.
- Current – The latest release with the newest features. Current releases become LTS after approximately six months. Node.js 23 is the current release track as of early 2026. Choose this only if you want to experiment with cutting-edge features.
For beginners, always choose LTS. It provides stability and the broadest compatibility with packages and tools.
Step 1: Download the Installer
Go to nodejs.org and click the LTS download button. This downloads a Windows installer (.msi file) for 64-bit systems. The file is typically around 30 MB.
Step 2: Run the Installer
Double-click the downloaded .msi file to launch the setup wizard.
- Welcome screen – Click Next.
- License agreement – Accept the terms and click Next.
- Destination folder – The default path is
C:\Program Files\nodejs\. Keep the default unless you have a specific reason to change it. - Custom setup – Make sure the following components are selected (they are by default):
- Node.js runtime
- npm package manager
- Add to PATH
- Tools for Native Modules – The installer offers to install Chocolatey and tools for compiling native C/C++ addons. If you plan to use packages that require native compilation (like
bcryptorsharp), check this box. Otherwise, skip it to save time; you can always install these tools later. - Click Install and wait for the process to complete.
Step 3: Verify the Installation
Open a new Command Prompt or PowerShell window (existing windows will not have the updated PATH) and run:
node -v
You should see output like v22.14.0 (the exact version depends on the current LTS release).
Next, verify npm:
npm -v
This should print a version number like 10.9.2.
If either command shows an error, restart your computer to ensure the PATH changes take effect and try again.
Step 4: Update npm
The version of npm bundled with Node.js may not be the latest. Update it:
npm install -g npm@latest
The -g flag installs the package globally, meaning it is available system-wide rather than only in a specific project.
Step 5: Test with a Simple Script
Create a file called hello.js with the following content:
console.log("Hello from Node.js!");
Run it from the terminal:
node hello.js
You should see Hello from Node.js! printed to the console. Congratulations, Node.js is working.
Managing Versions with nvm-windows
As you work on multiple projects, you will inevitably need different Node.js versions. Some legacy projects may require Node.js 18 while your new project uses Node.js 22. nvm-windows (Node Version Manager for Windows) solves this problem by letting you install and switch between multiple Node.js versions with a single command.
Installing nvm-windows
- Important: Uninstall any existing Node.js installation first. nvm-windows manages its own Node.js installations and conflicts can occur if a standalone version is already installed.
- Download the latest
nvm-setup.exefrom the nvm-windows releases page on GitHub (github.com/coreybutler/nvm-windows/releases). - Run the installer and follow the prompts. Accept the default directories.
Using nvm-windows
Open a new terminal and try these commands:
# List available Node.js versions
nvm list available
# Install the latest LTS version
nvm install lts
# Install a specific version
nvm install 22.14.0
# Switch to a specific version
nvm use 22.14.0
# List installed versions
nvm list
# Set a default version
nvm alias default 22.14.0
You can switch versions at any time with nvm use, and each version maintains its own set of globally installed packages.
Creating Your First npm Project
Now that Node.js and npm are installed, create a simple project:
mkdir my-node-app
cd my-node-app
npm init -y
The npm init -y command creates a package.json file with default values. This file is the heart of any Node.js project; it tracks metadata, scripts, and dependencies.
Installing Packages
Install a package, for example the popular express web framework:
npm install express
This does three things:
- Downloads
expressand its dependencies into anode_modulesfolder. - Adds
expressto thedependenciessection ofpackage.json. - Creates or updates
package-lock.json, which locks exact dependency versions for reproducibility.
Creating a Simple Server
Create a file called app.js:
const express = require("express");
const app = express();
const PORT = 3000;
app.get("/", (req, res) => {
res.send("Hello, World!");
});
app.listen(PORT, () => {
console.log(`Server running at http://localhost:${PORT}`);
});
Run the server:
node app.js
Open your browser and navigate to http://localhost:3000. You should see "Hello, World!" displayed on the page.
Adding npm Scripts
Open package.json and add a start script:
"scripts": {
"start": "node app.js",
"dev": "node --watch app.js"
}
Now you can run npm start to start the server and npm run dev to start it with the built-in file watcher (available in Node.js 22+), which automatically restarts the server when you modify files.
Troubleshooting Common Issues
"node is not recognized"
This means Node.js is not in your system PATH. Restart your terminal or computer. If the problem persists, manually add C:\Program Files\nodejs\ to your PATH environment variable.
npm Permission Errors
On Windows, global installs can sometimes fail due to permission issues. Run your terminal as Administrator, or better yet, use nvm-windows, which installs Node.js in a user-writable directory that avoids permission problems.
Package Installation Fails
If npm install fails with network errors, check your internet connection and proxy settings. You can also try clearing the npm cache:
npm cache clean --force
node_modules Is Huge
This is normal. The node_modules folder can contain thousands of files. Never commit it to Git; instead, add node_modules/ to your .gitignore file. Anyone who clones your project can recreate it by running npm install.
Understanding package.json
The package.json file is the manifest for every Node.js project. Here are its most important fields:
- name – The project name (must be lowercase, no spaces).
- version – The current version following semantic versioning (e.g.,
1.0.0). - scripts – Custom commands you can run with
npm run <script-name>. - dependencies – Packages required for your application to run in production.
- devDependencies – Packages needed only during development (testing tools, linters, build tools). Install these with
npm install --save-dev <package>.
When someone clones your project and runs npm install, npm reads package.json and package-lock.json to install the exact same dependencies you used, ensuring consistent behavior across machines.
Alternative Package Managers: pnpm and Yarn
While npm is the default, two popular alternatives offer different advantages:
- pnpm – Uses a content-addressable storage system that saves disk space by sharing packages across projects. It is also noticeably faster than npm for large installs. Install it globally with
npm install -g pnpm. - Yarn – Originally created by Facebook to address npm's early shortcomings. Yarn offers a similar experience to npm with some differences in lockfile format and workspace handling. Install with
npm install -g yarn.
All three managers use package.json and are largely interchangeable. Start with npm since it comes pre-installed, and explore alternatives later if you have specific needs.
Useful Global Packages
Some npm packages are designed to be installed globally for use as command-line tools:
npm install -g nodemon– Automatically restarts your Node.js app when files change (an alternative to the built-in--watchflag).npm install -g typescript– Installs the TypeScript compiler globally.npm install -g http-server– A simple static file server for testing HTML/CSS/JS projects.
Conclusion
Installing Node.js and npm on Windows is a quick process that unlocks the entire JavaScript ecosystem for your development work. Start with the LTS version for stability, verify your installation with node -v and npm -v, and consider using nvm-windows if you need to juggle multiple Node.js versions across projects. With npm at your fingertips, you have access to millions of packages that can accelerate every aspect of your development workflow.