How to fix npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available in npm

npmINTERMEDIATEHIGHUpdated Dec 5, 2025ยท 120 views

This error occurs when npm or Node.js attempts to bind to an IP address that doesn't exist on your machine. It's typically caused by incorrect network configuration, dynamic IP changes, or proxy issues.

Quick fix

Fixes npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available

echo $HOST
echo $HOSTNAME
  1. Check and clear the HOST environment variable
  2. Verify your current IP address and network configuration
  3. Update your npm registry configuration to use default settings
  4. Configure proxy settings if behind a corporate proxy
npm โ€” error
echo $HOST
echo $HOSTNAME
npm ERR! code EADDRNOTAVAIL
npm ERR! errno EADDRNOTAVAIL
npm ERR! Address not available

What this error means

EADDRNOTAVAIL (Address Not Available) is a network error that occurs when a Node.js application or npm registry client tries to establish a connection or bind to a socket using an IP address that is not actually assigned to your system. This usually happens when the HOST environment variable points to an IP address that no longer exists, was never valid on your machine, or when attempting to bind to an interface that isn't available in your network environment. The error indicates a mismatch between the configured network address and what your system actually has available. This is particularly common in dynamic network environments where IP addresses change (like DHCP), or when running applications in containerized/virtualized environments.

Typical symptoms

  • npm install fails with 'EADDRNOTAVAIL' error message
  • npm start or other npm scripts fail when trying to bind to a specific port
  • Error appears after machine restart or network reconnection
  • Application works on some machines but fails with EADDRNOTAVAIL on others
  • VPN connection changes trigger the error

Common causes

  1. HOST environment variable is set to an IP address that doesn't exist on your current machine
  2. Network IP address changed due to DHCP lease renewal or router restart
  3. Attempting to bind to a private IP address inside a container or virtualized environment
  4. npm configured to run behind a corporate proxy with incorrect proxy settings
  5. Connecting through a VPN that changes available network interfaces

How to fix "npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available"

1Check and clear the HOST environment variable

First, verify if a HOST environment variable is configured that might be causing the issue.

On Linux/macOS:

bash
echo $HOST
echo $HOSTNAME

On Windows (PowerShell):

powershell
$env:HOST
$env:HOSTNAME

If you find a problematic HOST variable, unset it:

On Linux/macOS:

bash
unset HOST

On Windows (PowerShell):

powershell
Remove-Item env:HOST
2Verify your current IP address and network configuration

Check what IP addresses are actually assigned to your machine:

On Linux/macOS:

bash
ifconfig
# or
ip addr show

On Windows:

bash
ipconfig

Make sure any IP address you're trying to bind to actually appears in this list. If it doesn't, that's why you're getting EADDRNOTAVAIL.

3Update your npm registry configuration to use default settings

If you have custom npm registry or network settings, reset them to defaults:

bash
npm config list

npm config delete registry
npm config delete https-proxy
npm config delete proxy
npm config delete http-proxy

npm config set registry https://registry.npmjs.org/

Alternatively, remove or rename your .npmrc file:

bash
mv ~/.npmrc ~/.npmrc.backup
npm install
4Configure proxy settings if behind a corporate proxy

If you're behind a corporate proxy, configure npm to use it properly:

bash
npm config set proxy http://proxy.example.com:8080
npm config set https-proxy http://proxy.example.com:8080

You can also set environment variables:

bash
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
npm install
5For applications, use 0.0.0.0 to listen on all interfaces

For applications (not npm install), if binding to a specific IP is required, use 0.0.0.0 to listen on all available interfaces instead:

javascript
// Instead of:
app.listen(3000, '192.168.1.100')

// Use:
app.listen(3000, '0.0.0.0')

// Or for localhost only:
app.listen(3000, '127.0.0.1')

If running in a container, always use 0.0.0.0 since the container doesn't have access to your host machine's private IP addresses.

Advanced notes

EADDRNOTAVAIL commonly occurs in containerized environments (Docker, Kubernetes) because the container is isolated from the host network. If you're running npm inside a container, always configure applications to listen on 0.0.0.0 rather than specific IP addresses. For ephemeral port exhaustion issues, increase your system's port range: on Linux, check cat /proc/sys/net/ipv4/ip_local_port_range and increase it if needed.

Frequently asked questions

What does "npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Addr" mean?
js application or npm registry client tries to establish a connection or bind to a socket using an IP address that is not actually assigned to your system. This usually happens when the HOST environment variable points to an IP address that no longer exists, was never valid on your machine, or when attempting to bind to an interface that isn't available in your network environment. The error indicates a mismatch between the configured network address and what your system actually has available.
How do I fix "npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Addr"?
This error occurs when npm or Node.js attempts to bind to an IP address that doesn't exist on your machine. It's typically caused by incorrect network configuration, dynamic IP changes, or proxy issues.
What causes "npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Addr"?
HOST environment variable is set to an IP address that doesn't exist on your current machine Network IP address changed due to DHCP lease renewal or router restart Attempting to bind to a private IP address inside a container or virtualized environment
Is the "npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Addr" 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