How to fix npm ERR! 429 Too Many Requests in npm

npmINTERMEDIATEMEDIUMUpdated Dec 6, 2025ยท 2,061 views

The HTTP 429 Too Many Requests error occurs when you've exceeded npm registry rate limits. This is common in CI/CD environments with many concurrent jobs or during aggressive scripting.

Quick fix

Fixes npm ERR! 429 Too Many Requests

# Check retry-after header (if present)
# Wait the specified time, then retry
sleep 60
npm install
  1. Wait and retry
  2. Enable npm caching
  3. Use npm ci with caching in CI
  4. Authenticate to get higher limits
npm โ€” error
# Check retry-after header (if present)
# Wait the specified time, then retry
sleep 60
npm install
npm ERR! 429 Too Many Requests

What this error means

HTTP 429 is a rate limiting response - you've made too many requests to the npm registry in a short time period. The registry implements rate limiting to ensure fair access for all users and protect against abuse. Rate limits apply to both authenticated and anonymous users, with authenticated users typically getting higher limits. CI/CD environments often hit these limits due to parallel jobs all requesting packages simultaneously.

Typical symptoms

  • npm install fails with 429 error
  • Error occurs during CI/CD pipeline runs
  • Multiple concurrent builds failing
  • Error mentions rate limit or throttling
  • Works after waiting, then fails again
  • Intermittent failures in automation

Common causes

  1. Too many concurrent npm requests
  2. Parallel CI/CD jobs
  3. Aggressive scripting or automation
  4. Missing package caching
  5. Large monorepo with many packages
  6. Anonymous requests (lower limits)
  7. Shared IP with other npm users

How to fix "npm ERR! 429 Too Many Requests"

1Wait and retry

Respect the rate limit:

bash
# Check retry-after header (if present)
# Wait the specified time, then retry
sleep 60
npm install

Rate limits typically reset within minutes.

2Enable npm caching

Cache packages to reduce requests:

bash
# Local cache is automatic, but verify
npm config get cache

# Force cache usage
npm install --prefer-offline
3Use npm ci with caching in CI

Optimize CI/CD:

yaml
# GitHub Actions
- uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
4Authenticate to get higher limits

Log in for increased rate limits:

bash
npm login

# Or use token in CI
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
5Reduce parallel requests

Limit concurrency:

bash
# Reduce concurrent connections
npm config set maxsockets 3

# In CI, stagger job starts
# Or use a single install job that caches
6Set up npm proxy/mirror

Use a caching proxy:

bash
# Use Verdaccio, Nexus, or Artifactory as proxy
npm config set registry http://npm-proxy.company.com

This reduces direct registry requests.

Advanced notes

For large organizations, npm Enterprise or a self-hosted registry eliminates public rate limits. Consider using pnpm or yarn which have different request patterns. In Kubernetes, use a shared npm cache volume or service. Monitor registry response headers for rate limit information. GitHub Actions cache can persist across workflow runs.

Frequently asked questions

What does "npm ERR! 429 Too Many Requests" mean?
HTTP 429 is a rate limiting response - you've made too many requests to the npm registry in a short time period. The registry implements rate limiting to ensure fair access for all users and protect against abuse. Rate limits apply to both authenticated and anonymous users, with authenticated users typically getting higher limits.
How do I fix "npm ERR! 429 Too Many Requests"?
The HTTP 429 Too Many Requests error occurs when you've exceeded npm registry rate limits. This is common in CI/CD environments with many concurrent jobs or during aggressive scripting.
What causes "npm ERR! 429 Too Many Requests"?
Too many concurrent npm requests Parallel CI/CD jobs Aggressive scripting or automation
Is the "npm ERR! 429 Too Many Requests" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading