How to fix npm ERR! Temporary failure, please try again in npm

npmBEGINNERMEDIUMUpdated Dec 5, 2025· 133 views

This error indicates npm encountered a temporary failure communicating with the npm registry or during network operations. Usually resolved by retrying, clearing cache, or checking network/proxy settings.

Quick fix

Fixes npm ERR! Temporary failure, please try again

npm install
  1. Retry the npm command
  2. Clear npm cache to remove corrupted data
  3. Remove and reinstall node_modules and lock file
  4. Check and fix proxy configuration
npm — error
npm install
npm ERR! Temporary failure, please try again
shell
npm install

What this error means

This error indicates that npm encountered a temporary failure while attempting to communicate with the npm registry or perform a network-dependent operation. The error occurs when npm's connection is interrupted, the registry is temporarily unavailable, or network connectivity issues prevent the package manager from completing its request. The 'please try again' message indicates that npm recommends a retry, as these failures are often transient and may resolve on subsequent attempts.

Typical symptoms

  • npm install command hangs or fails mid-installation with the temporary failure message
  • Installation works on some networks or at different times but fails consistently on others
  • Commands eventually timeout after retries (ESOCKETTIMEDOUT or ETIMEDOUT errors may follow)
  • npm operations fail when behind a corporate proxy or VPN but work on unrestricted networks
  • The error appears intermittently and succeeds when the command is retried immediately

Common causes

  1. Network connectivity interruption or instability during package download from npm registry
  2. Corporate proxy or firewall blocking or throttling requests to registry.npmjs.org
  3. DNS resolution failures or unavailable DNS servers
  4. npm registry experiencing temporary unavailability or high load
  5. Outdated or incorrect proxy configuration left in npm settings or environment variables
  6. Slow or unreliable internet connection causing request timeouts

How to fix "npm ERR! Temporary failure, please try again"

1Retry the npm command

Start with the simplest solution—npm recommends retrying as these are often transient failures:

bash
npm install

Many temporary failures resolve on the next attempt without any configuration changes.

2Clear npm cache to remove corrupted data

npm's cache may contain corrupted or stale data. Clear it and verify its integrity:

bash
# Force clean the cache
npm cache clean --force

# Or verify cache integrity
npm cache verify

After clearing the cache, retry your npm command.

3Remove and reinstall node_modules and lock file

A corrupted node_modules directory or package-lock.json can cause npm to fail:

bash
# Remove node_modules and lock file
rm -rf node_modules package-lock.json

# Reinstall dependencies
npm install
4Check and fix proxy configuration

Corporate proxies or misconfigured proxy settings are a frequent cause. Check your current proxy settings:

bash
# View current proxy settings
npm config get proxy
npm config get https-proxy

If you see proxy URLs configured and you're not behind a corporate proxy, remove them:

bash
npm config rm proxy
npm config rm https-proxy

If you ARE behind a corporate proxy, configure npm to use it:

bash
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
5Verify network connectivity and try alternative networks

Test your connectivity and try an alternative network:

bash
# Test DNS resolution
ping registry.npmjs.org
nslookup registry.npmjs.org

# Or from Node
node -e "require('dns').lookup('registry.npmjs.org', console.log)"

If DNS resolution fails, configure a different DNS server (like Google's 8.8.8.8). Try tethering to a mobile hotspot to test if the registry is reachable on other networks.

6Update Node.js and npm to the latest versions

Outdated npm versions have known networking issues. Ensure you're running recent versions:

bash
# Check your current versions
node --version
npm --version

# Update npm to the latest version
npm install -g npm@latest

After updating, clear your cache and try again:

bash
npm cache clean --force
npm install

Advanced notes

For CI/CD environments and Docker builds, use the --no-audit flag if npm hangs during the audit phase: npm install --no-audit. Additionally, set higher timeout values if you're on slow connections: npm config set fetch-timeout 60000 (60 seconds). If issues persist, check your package-lock.json for outdated or unreachable registry URLs. On restricted networks, consider using npm's offline mode by pre-downloading packages or using a private npm registry proxy like Verdaccio.

Frequently asked questions

What does "npm ERR! Temporary failure, please try again" mean?
This error indicates that npm encountered a temporary failure while attempting to communicate with the npm registry or perform a network-dependent operation. The error occurs when npm's connection is interrupted, the registry is temporarily unavailable, or network connectivity issues prevent the package manager from completing its request. The 'please try again' message indicates that npm recommends a retry, as these failures are often transient and may resolve on subsequent attempts.
How do I fix "npm ERR! Temporary failure, please try again"?
This error indicates npm encountered a temporary failure communicating with the npm registry or during network operations. Usually resolved by retrying, clearing cache, or checking network/proxy settings.
What causes "npm ERR! Temporary failure, please try again"?
Network connectivity interruption or instability during package download from npm registry Corporate proxy or firewall blocking or throttling requests to registry.npmjs.org DNS resolution failures or unavailable DNS servers
Is the "npm ERR! Temporary failure, please try again" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading