How to fix npm ERR! code EHOSTDOWN npm ERR! errno EHOSTDOWN npm ERR! Host is down in npm
The EHOSTDOWN error occurs when npm cannot connect to the npm registry or another host due to network issues, firewall blocks, or IPv6 misconfigurations. Fixing it requires checking your network connectivity and registry configuration.
Quick fix
Fixes npm ERR! code EHOSTDOWN npm ERR! errno EHOSTDOWN npm ERR! Host is down
# Test basic internet connectivity
ping 8.8.8.8
# Test DNS resolution
ping registry.npmjs.org- Check your internet connection and registry status
- Clear npm cache and check your configuration
- Disable IPv6 as a network diagnostic step
- Configure npm to work with a proxy
# Test basic internet connectivityping 8.8.8.8# Test DNS resolutionping registry.npmjs.orgnpm ERR! code EHOSTDOWNnpm ERR! errno EHOSTDOWNnpm ERR! Host is down
What this error means
EHOSTDOWN is a network-level error that indicates the npm client was unable to reach the specified host. This typically happens when npm tries to connect to registry.npmjs.org or a custom npm registry, but the connection is blocked or the host is unreachable. The error can stem from several sources: your internet connection may be down, a firewall or corporate proxy may be blocking access, DNS resolution may be failing, or IPv6 routing issues may be preventing the connection. Unlike ECONNREFUSED (which means the server rejected the connection), EHOSTDOWN means the client couldn't even reach the host to attempt a connection.
Typical symptoms
- npm install fails immediately with 'EHOSTDOWN' error when trying to fetch packages
- ping registry.npmjs.org succeeds but npm install fails
- npm works fine on a different network but fails on your current network
- npm commands fail only when behind a corporate firewall or VPN
- The error occurs intermittently, sometimes succeeding and sometimes failing
Common causes
- IPv6 is enabled on your system and routing traffic through IPv6 addresses that don't have proper connectivity to the registry
- A firewall (personal, corporate, or ISP-level) is blocking outbound HTTPS connections to registry.npmjs.org on port 443
- Your system's DNS cannot resolve registry.npmjs.org to its IP address
- You're behind a corporate proxy that requires authentication or configuration
- The npm registry is temporarily experiencing an outage
How to fix "npm ERR! code EHOSTDOWN npm ERR! errno EHOSTDOWN npm ERR! Host is down"
First, verify that your internet is actually working and the npm registry is online.
# Test basic internet connectivity
ping 8.8.8.8
# Test DNS resolution
ping registry.npmjs.orgIf ping to 8.8.8.8 fails, your internet is down. If ping to registry.npmjs.org fails or shows 'Destination Host Unreachable', you have a firewall or routing issue. Check https://status.npmjs.org for registry outages.
Clear any corrupted cache and review your npm configuration:
npm cache clean --force
npm config ls
npm config get registry
npm config get proxy
npm config get https-proxyVerify the registry is set to https://registry.npmjs.org (or your custom registry). If you see proxy values set, make note of them as they may be causing the issue.
IPv6 misconfigurations are a common cause of EHOSTDOWN errors. Temporarily disable it to test:
On Linux/macOS:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1On Windows (PowerShell as Admin):
Reg add HKLM\SYSTEM\CurrentControlSet\Services\TCPIP6\Parameters /v DisabledComponents /t REG_DWORD /d 0xffAfter disabling IPv6, try npm install again. If it succeeds, you've found the root cause.
If you're behind a corporate firewall or proxy, configure npm to use it:
npm config set proxy http://proxy.example.com:8080
npm config set https-proxy http://proxy.example.com:8080
npm installTo reset proxy settings later:
npm config set proxy null
npm config set https-proxy nullYour local and global .npmrc files may have stale or incorrect configuration:
cat ~/.npmrc
cat .npmrc
npm config ls --allLook for any unusual registry URLs, proxy settings, or other network-related config. If you find incorrect entries:
npm config delete registry
npm config delete proxyIf still having issues, try with verbose output:
npm install --verboseAdvanced notes
EHOSTDOWN is a lower-level socket error that indicates the host is unreachable at the network level, different from ECONNREFUSED (connection rejected) or ENOTFOUND (DNS lookup failed). If IPv6 disabling fixes your issue, consider making it permanent on your system. Some users have reported that connecting to a VPN resolves EHOSTDOWN issues, suggesting the problem may be ISP-level routing or firewall policies. If you're using a corporate network, contact your IT department about proxy requirements or firewall rules blocking port 443 to registry.npmjs.org.
Frequently asked questions
- What does "npm ERR! code EHOSTDOWN npm ERR! errno EHOSTDOWN npm ERR! Host is down" mean?
- EHOSTDOWN is a network-level error that indicates the npm client was unable to reach the specified host. org or a custom npm registry, but the connection is blocked or the host is unreachable. The error can stem from several sources: your internet connection may be down, a firewall or corporate proxy may be blocking access, DNS resolution may be failing, or IPv6 routing issues may be preventing the connection.
- How do I fix "npm ERR! code EHOSTDOWN npm ERR! errno EHOSTDOWN npm ERR! Host is down"?
- The EHOSTDOWN error occurs when npm cannot connect to the npm registry or another host due to network issues, firewall blocks, or IPv6 misconfigurations. Fixing it requires checking your network connectivity and registry configuration.
- What causes "npm ERR! code EHOSTDOWN npm ERR! errno EHOSTDOWN npm ERR! Host is down"?
- IPv6 is enabled on your system and routing traffic through IPv6 addresses that don't have proper connectivity to the registry A firewall (personal, corporate, or ISP-level) is blocking outbound HTTPS connections to registry.npmjs.org on port 443 Your system's DNS cannot resolve registry.npmjs.org to its IP address
- Is the "npm ERR! code EHOSTDOWN npm ERR! errno EHOSTDOWN npm ERR! Host is down" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐Docs: npm registry config(Official Docs)
- ๐ฌSO: npm host down errors(Stack Overflow)
- ๐GitHub: npm issues(GitHub)