How to Speed Up npm Install on Windows: 5 Proven Fixes
Published September 22, 2026 · Editorial policy

If you are a Tier-1 developer working on a modern JavaScript or TypeScript stack on a Windows machine, you have likely experienced the agonizing crawl of npm install.
While your macOS and Linux peers seem to breeze through dependency resolution, your Windows terminal often locks up, crawling through tens of thousands of files while Windows Defender aggressively scans every single extracted module. Node.js and npm have historically struggled with the Windows filesystem API (NTFS), making npm install a major bottleneck in local development workflows.
Fortunately, you can drastically reduce your installation times. Here are 5 proven, production-ready fixes to speed up npm install on Windows.
1. Upgrade to npm v10+ and Node.js LTS
It sounds obvious, but many enterprise development environments lock down Node.js versions for compliance reasons, leaving developers stuck on ancient tooling. If you are running Node.js 16 or earlier with npm v7 or v8, you are missing out on years of massive performance rewrites.
The npm team completely overhauled the dependency resolution engine and tree-fetching algorithms in recent versions. Furthermore, modern versions of npm include significant caching improvements and more efficient network socket management.
How to Fix It
First, check your current Node and npm versions:
node -v
npm -v
If you are running anything below Node.js 18.x and npm 10.x, it is time to upgrade. On Windows, the cleanest way to manage Node versions without permission issues or path conflicts is using nvm-windows (Node Version Manager for Windows).
- Download and install the latest release of
nvm-windowsfrom the official GitHub repository. - Open a new terminal (as Administrator, once) and install the latest LTS version of Node.js:
nvm install lts
nvm use lts
Verify that your global packages and project dependencies still resolve correctly. Moving from npm v8 to npm v10 alone can yield up to a 30% speed improvement on cold installs.
2. Configure Windows Defender Exclusions
By far the biggest hardware-level bottleneck for npm install on Windows is real-time antivirus scanning.
When npm install runs, it extracts thousands of tiny files into node_modules simultaneously. Windows Defender intercepts every single file write operation to scan for signatures. Because node_modules consists of massive quantities of small I/O operations rather than large sequential writes, the antivirus overhead completely chokes your disk throughput, even on high-end NVMe SSDs.
How to Fix It
You can safely exclude your development directory or specific project folders from Windows Defender real-time scanning.
Via PowerShell (Admin):
Run the following command in an elevated PowerShell prompt to exclude your entire projects directory (e.g., C:\Projects):
Add-MpPreference -ExclusionPath "C:\Projects"
Via Windows GUI:
- Open Windows Security from your Start menu.
- Go to Virus & threat protection > Manage settings (under Virus & threat protection settings).
- Scroll down to Exclusions and click Add or remove exclusions.
- Click Add an exclusion and select Folder, then choose your primary workspace directory.
Note: Only exclude directories containing trusted source code and dependencies. This single adjustment frequently drops clean install times on Windows by 50% or more.
3. Switch to npm ci for CI/CD and Clean Builds
If you are running npm install on a fresh clone or inside a Docker container on Windows, you are likely using the wrong command.
The standard npm install command reads package.json, resolves dependencies, updates package-lock.json if discrepancies are found, and then installs. This metadata resolution phase is computationally heavy and entirely unnecessary when you already have a locked dependency tree.
How to Fix It
Use npm ci (Clean Install) instead of npm install whenever you are setting up a project from scratch, running automated scripts, or deploying.
npm ci
Why It’s Faster:
- Bypasses resolution: It reads directly from
package-lock.json, treating it as read-only. This eliminates the expensive dependency tree-resolving phase. - Wipes
node_modules: It automatically deletes the existingnode_modulesfolder before installing, preventing corrupt or overlapping states. - Deterministic: It fails if
package.jsonandpackage-lock.jsonare out of sync, ensuring your local environment matches your team's specifications exactly.
Tip: For day-to-day development where you are only adding or updating a single package, stick to npm install <pkg>. For everything else, make npm ci your default.
4. Optimize Network and Cache Settings
Sometimes the bottleneck isn't your disk—it's your network stack. Default npm configurations can suffer from slow DNS lookups, aggressive IPv6 resolution attempts, or degraded registry connections.
Additionally, managing your local npm cache efficiently ensures you aren't pulling redundant tarballs over the wire.
How to Fix It
Disable IPv6 for npm (Optional but Effective)
Some Windows network stacks struggle with IPv6 routing to the public npm registry, causing intermittent connection timeouts and hanging installs. Force npm to prefer IPv4:
npm config set proxy null
npm config set https-proxy null
If you notice DNS resolution hangs, ensure your network adapter is using a reliable public DNS provider like Cloudflare (1.1.1.1) or Google (8.8.8.8).
Verify and Clean Your Cache
Corrupted cache entries can force npm to fallback to network requests instead of using local copies. Periodically verify your cache integrity:
npm cache verify
If your cache has grown bloated over the years, you can clean it entirely:
npm cache clean --force
5. Adopt Alternative Package Managers (pnpm or Yarn)
If you have optimized your Node version, configured your antivirus, and cleaned your cache, but you are still experiencing unacceptable speeds, the architectural design of npm itself might be the limiting factor.
Standard npm creates a nested or flat node_modules structure that duplicates packages and heavily taxes the Windows file system API during path resolution.
Modern alternatives like pnpm or Yarn (v2+) solve this at the architectural level.
How to Fix It: pnpm
pnpm uses a content-addressable storage model. Every file on your disk is stored in a single global location. When you install dependencies for a project, pnpm uses hard links and symbolic links to point to that single global store, rather than copying files into a local node_modules folder.
This drastically reduces disk space usage and makes installations on Windows blazingly fast.
- Install
pnpmglobally via npm:
npm install -g pnpm
- In your project directory, remove your old
node_modulesand lockfile (if switching):
rmdir /s /q node_modules
del package-lock.json
- Install dependencies using pnpm:
pnpm install
If your team uses standard npm for publishing or deployment, don't worry—pnpm fully respects package.json and generates standard-compliant output when necessary, though you will commit a pnpm-lock.yaml file instead of a package-lock.json.
Summary Checklist for Windows Developers
To recap, if you want to eliminate slow npm install times on your Windows workstation once and for all, execute this checklist:
- Update: Ensure you are running Node.js LTS and npm v10+ via
nvm-windows. - Exclude: Add your workspace folder to Windows Defender real-time scanning exclusions.
- Use
npm ci: Stop runningnpm installon fresh checkouts. - Clean Cache: Run
npm cache verifyto keep local operations smooth. - Migrate: Switch to
pnpmfor large enterprise monorepos or projects with massive dependency trees.
Implementing even two or three of these fixes will return hours of lost productivity to your development cycle.


