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.
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.
Respect the rate limit:
# Check retry-after header (if present)
# Wait the specified time, then retry
sleep 60
npm installRate limits typically reset within minutes.
Cache packages to reduce requests:
# Local cache is automatic, but verify
npm config get cache
# Force cache usage
npm install --prefer-offlineOptimize CI/CD:
# GitHub Actions
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- run: npm ciLog in for increased rate limits:
npm login
# Or use token in CI
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKENLimit concurrency:
# Reduce concurrent connections
npm config set maxsockets 3
# In CI, stagger job starts
# Or use a single install job that cachesUse a caching proxy:
# Use Verdaccio, Nexus, or Artifactory as proxy
npm config set registry http://npm-proxy.company.comThis reduces direct registry requests.
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.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error