The "proxy authentication required" error (HTTP 407) occurs when npm cannot authenticate with a corporate proxy server. This requires configuring npm with valid proxy credentials.
This error indicates that your network requires traffic to go through an authenticated proxy, and npm hasn't provided valid credentials. Corporate networks often use proxy servers for security, monitoring, and caching purposes. When the proxy returns HTTP 407, it means npm's request was intercepted and credentials are required. Unlike HTTP 401 (server auth), 407 specifically means the proxy server (not the destination) requires authentication.
Set up authenticated proxy:
# With username and password
npm config set proxy http://username:[email protected]:8080
npm config set https-proxy http://username:[email protected]:8080URL-encode special characters in password (@ becomes %40, etc.)
Set proxy via environment (may be more secure):
export HTTP_PROXY=http://username:[email protected]:8080
export HTTPS_PROXY=http://username:[email protected]:8080
export NO_PROXY=localhost,127.0.0.1,.company.comURL-encode special characters:
# If password is "P@ss#word!"
# @ = %40, # = %23, ! = %21
npm config set proxy http://user:P%40ss%23word%21@proxy:8080Common encodings: @ = %40, # = %23, $ = %24, ! = %21, & = %26
Use a local proxy helper like cntlm:
# Install cntlm
sudo apt install cntlm # Linux
brew install cntlm # macOS
# Configure /etc/cntlm.conf with domain\username and password
# Start cntlm
sudo cntlm -c /etc/cntlm.conf
# Point npm to cntlm
npm config set proxy http://localhost:3128Check your current npm proxy configuration:
npm config get proxy
npm config get https-proxy
npm config listEnsure values match your corporate proxy.
Verify the proxy works:
# Test with curl
curl -x http://user:pass@proxy:8080 https://registry.npmjs.org
# Check npm verbose output
npm install --verbose 2>&1 | grep -i proxyFor NTLM/Kerberos environments, tools like cntlm, px, or Fiddler can act as local proxies handling Windows authentication. In CI/CD, use secret management for proxy credentials - never commit them to code. Some enterprises use PAC files - npm doesn't support these directly, but you can parse them to find the proxy URL. Consider setting up an internal npm registry to reduce external proxy dependencies.
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