The ENETDOWN error indicates your machine's network interface is down or unavailable, preventing npm from reaching the registry. This is typically caused by connectivity issues, network adapter problems, or proxy configuration conflicts.
ENETDOWN is a system-level network error code that translates to 'Network is down.' When npm encounters this error, it means the operating system is reporting that the network interface is unavailable or disabled. This prevents npm from establishing a connection to registry.npmjs.org to download packages. Unlike other npm errors that indicate configuration or permission issues, ENETDOWN is a fundamental connectivity problem at the OS level. The error occurs during the 'connect' syscall when npm tries to communicate with the npm registry.
Test basic connectivity to confirm your network interface is working. Open a terminal and run:
ping -c 4 google.comOn Windows, use:
ping google.comIf ping fails or times out, your network interface is down. Try:
1. Toggling WiFi off and back on
2. Unplugging and replugging your Ethernet cable
3. Disabling airplane mode if enabled
If your network shows as active but npm still fails, restart the networking stack.
On macOS:
sudo ifconfig en0 down && sudo ifconfig en0 upOn Linux (systemd):
sudo systemctl restart networking
# or for NetworkManager:
sudo systemctl restart NetworkManagerOn Windows (PowerShell as Admin):
Disable-NetAdapter -Name "Ethernet" -Confirm:$false
Start-Sleep -Seconds 2
Enable-NetAdapter -Name "Ethernet" -Confirm:$falseMisconfigured proxy settings can cause ENETDOWN errors. Check your npm configuration:
npm config listLook for any proxy, http-proxy, or https-proxy settings. If you're not behind a corporate proxy, remove them:
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxyAlso check environment variables:
echo $HTTP_PROXY
echo $HTTPS_PROXY
unset HTTP_PROXY
unset HTTPS_PROXYSometimes cached data can cause persistent connection errors. Clear the npm cache:
npm cache clean --forceThen try your npm install again:
npm installFor Docker containers:
Ensure your container has network access:
docker run --rm alpine ping -c 4 google.com
docker run --rm alpine nslookup registry.npmjs.orgIf DNS fails, specify DNS servers when running the container:
docker run --dns 8.8.8.8 --dns 8.8.4.4 your-imageVerify npm registry accessibility:
curl -I https://registry.npmjs.orgOn Node.js 18+, IPv6 resolution issues can cause network errors. If you're experiencing ENETDOWN or related network errors with newer Node versions, try forcing IPv4:
export NODE_OPTIONS="--dns-result-order=ipv4first"
npm installAlways check the full npm log file (located at ~/.npm/_logs/) for detailed error context.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
npm ERR! code EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code EMPTYPACKAGE npm ERR! Package contains no files
How to fix 'npm ERR! code EMPTYPACKAGE' - Package contains no files
npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing
How to fix "npm ERR! code EWORKSPACEMISSING - Workspace does not exist" error
npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available
How to fix "npm ERR! code EADDRNOTAVAIL - Address not available" error