IMD SolutionComputing LibraryShop main store

Troubleshooting

Node-RED getaddrinfo EAI_AGAIN means DNS, not internet

Edge computing and IIoT Published 7 min read By IMD Solution engineering team

Short answer

getaddrinfo EAI_AGAIN is a DNS lookup timeout: nothing answered the resolver for registry.npmjs.org within the retry window. A working ping, apt or Grafana download does not test that lookup. Find the DNS servers the active interface (eno2 in the worked example) actually received, point it at a known-good resolver, then confirm a package install completes.

On this page
  1. What getaddrinfo EAI_AGAIN actually reports
  2. What working pings and apt do and do not prove
  3. Read the resolver the active interface received
  4. The fix, with the subnet arithmetic shown
  5. When the resolver answers but installs still fail
  6. Decide by symptom
  7. Questions asked

When an npm install or a Palette Manager download dies with getaddrinfo EAI_AGAIN registry.npmjs.org, the resolver asked for the npm registry's address and no name server answered in time. That code is a DNS lookup timeout, not proof that the internet is down — and a device that still answers pings and still installs packages through apt is telling you the same: link and routing work, and the untested part is the one lookup npm needs. Read the DNS servers the active interface actually received before touching Node-RED or npm. This page walks that check on a two-port edge PC, shows the subnet arithmetic that explains why ping succeeds while npm fails, and ends with the decision for each symptom.

What getaddrinfo EAI_AGAIN actually reports #

The install log names the failing step. The package name changes from case to case; the tail does not:

ERR! request to https://registry.npmjs.org/node-red-contrib-postgresql failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

getaddrinfo is the system name lookup that Node.js calls for every hostname it connects to, and EAI_AGAIN is that call's code for a temporary resolution failure: a name server was queried and did not answer within the retry window. That is the documented meaning of the code, not an inference from the package name. The Palette Manager drives the same install path, so the code shows up there too.

Two consequences follow. The failing package is incidental: one node failing while the rest install points at that node, but every package failing identically points at the shared resolver path in front of npm. And temporary cuts both ways: a single timeout can clear on a retry, while the same code on every package at every attempt points at configuration — the resolver list the active interface received.

What working pings and apt do and do not prove #

In the case behind this page the device answered a ping to an outside name and installed Grafana from its repository, yet every npm install failed. Each observation tests something narrower than the lookup npm needs.

Observation What it proves What it leaves open
A ping to an outside name answers An IP path exists, and that one name resolved Nothing about the npm registry name
Grafana installs from its repository The resolver answers for those repository names Whether the npm registry name resolves
The Palette Manager lists packages The catalog list is visible, which it can be even while downloads fail Whether the registry is reachable for downloads
The same packages install on a nearby PC The registry is reachable from the LAN That the device uses the same resolver

The reading that matters: none of the green lights above exercises the failing name, so none of them can clear it. A resolver that answers some names and times out on others — a filtered or selectively failing upstream — passes all three while npm dies. Prove the failing lookup directly, on the device, before deciding anything.

Read the resolver the active interface received #

The case's edge PC has two wired ports: the first, eno1, is disabled; the second, eno2, holds the active link with automatic IPv4 from a router that hands out fixed leases. Address, mask, gateway and DNS servers all arrive in that lease, but they are separate settings on the server side: a fixed-address pool can deliver address and router while its DNS option is empty or stale. The interface then looks online — pings answer, routes exist — while getaddrinfo has nobody to ask and burns its retry window into EAI_AGAIN. The unit in the case ran a vendor example image v1.2.2 with Node.js 12.22.5 and Node-RED 2.0.6; the fault does not depend on those versions, and any Linux edge PC whose active link lacks a resolver times out the same way.

List what the link actually received. On images that run systemd-resolved, ask for the link by name:

resolvectl status eno2

On images without it, read the resolver file the system uses, /etc/resolv.conf. Two shapes mean trouble: no name server at all, or a loopback entry such as 127.0.0.1 with no local resolver running behind it — either way the device has nobody to ask. Then run the lookup npm runs, on the device and on the PC that installs fine:

getent hosts registry.npmjs.org

If the PC answers in a fraction of a second while the device hangs for seconds and returns nothing, the interface's resolver list is the fault. If the device resolves its apt mirror but not the npm registry name, the resolver answers selectively — a filtering or failing upstream, which is a resolver-policy fault, not an npm fault.

The fix, with the subnet arithmetic shown #

Put numbers on the layout to see why the symptoms split the way they do; the addresses are an example, so read yours from the leases. The device's active link holds 192.168.1.60/24 with gateway 192.168.1.1 and no DNS server; the working PC holds 192.168.1.20/24 with the same gateway and lists it as its DNS server. Subnet check, bitwise AND with the mask: 192.168.1.60 AND 255.255.255.0 gives 192.168.1.0, and the PC's 192.168.1.20 AND 255.255.255.0 gives the same 192.168.1.0 — one subnet, one router, which is why the ping works. Resolver count: one on the PC, zero on the device's active link. Zero is the whole fault: name lookups have nowhere to go, so npm times out on every package while everything that needs no lookup keeps working.

The repair gives the active link a resolver that answers — the router address the PC already uses. Set it where eno2 got its automatic IPv4, in the image's network settings, or correct the DNS option in the router's DHCP pool so every lease, present and future, carries it. On a segmented plant network, agree the resolver with whoever owns the segmentation policy, because pointing an OT device at a new resolver can cross a boundary the network was built to keep.

Verify in order: the lookup answers on the device, then one previously failing package — a PostgreSQL client node in the case — installs from the Palette Manager or npm and completes without the code. A ping, or another apt success, does not verify this repair; only the operation that failed completing does. The same timeout hits the IOT2000 family the same way, and the npm EAI_AGAIN DNS resolution fix for the IOT2000 walks the resolver correction on that hardware. On the earlier model, the npm EAI_AGAIN walkthrough for the IOT2040 covers the identical error.

When the resolver answers but installs still fail #

If the lookup now answers on the device and installs still fail, stop debugging DNS: the remaining suspects are the Node-RED process environment and anything sitting between the device and the registry. Capture what the running process actually sees — stop the autostart service, run node-red start in a terminal, reproduce one install, keep the complete console output, then re-enable the service so the device boots as before. If the plant pushes npm through a proxy, the failure signature changes, and the proxy checks in why the InfluxDB node install fails in Node-RED behind a proxy are the next step. If the catalog list itself will not load, that is the gateway-and-DNS case in failed to load node catalog: check the gateway and DNS first.

Decide by symptom #

  • One package fails, the rest install: a package-specific fault — chase that node, not DNS.
  • Every package fails with getaddrinfo EAI_AGAIN while pings and apt succeed: the resolver on the active interface. Put a DNS server that answers on that link; the repair is done when an install completes.
  • Some names resolve, the npm registry name times out: a filtering or selectively failing resolver — point the device at one that answers for that name, or have the name allowed at the filtering box.
  • Nothing resolves by name and a ping to an address fails too: a link or gateway fault — cabling, switch and default route come before npm.
  • EAI_AGAIN appears only now and then or under load: an overloaded or slow resolver — move the device to a faster one and retry once; if the code returns consistently, treat it as configuration.

For the case behind this page the decision is the second row: link up, apt fine, every npm lookup timing out — configure DNS on the active interface, and the installs come back.

Questions asked

Is EAI_AGAIN a permanent failure?

No. It is the resolver's temporary-failure result: a name server was asked and did not answer in time, so the same lookup can succeed minutes later, which is why a retry sometimes works. When every package fails the same way across hours, treat it as configuration instead: read the DNS servers the active interface received, compare them with a machine that installs fine, and put a resolver that answers on the link.

Why does the same install work on an office PC on the same switch?

Because machines on one subnet can carry different resolver settings. The PC's lease lists a working DNS server, while the edge device's active link can list none, a loopback stub with nothing behind it, or a filtering server that times out on the npm registry name. Compare the two resolver lists before touching npm; closing that difference usually finishes the repair.

How do I capture the Node-RED startup log for this error?

Stop the Node-RED autostart service first so the manual instance does not fight it for the port, then run node-red start in a terminal, reproduce one failed install, and keep the complete console output from startup through the failure. The log shows the environment the running process actually has, including proxy variables. Re-enable the autostart service afterwards so the device boots as before.

Can a proxy cause the same install failure?

A proxy that cannot be reached produces its own connection failure, and it is easy to conflate with a resolver timeout. Test name resolution first: if the registry name resolves on the device and a plain install still fails, read the proxy settings in the npm and Node-RED environment next. The two faults need different fixes, and the lookup test separates them in under a minute.

Should the fix go on the device or on the DHCP server?

Prefer the server when several devices share the pool: correcting the DNS option in the router's DHCP pool repairs every lease it hands out, including renewals on units already running. Set it on the single device when only one unit is affected or when you need a targeted change. Either way, confirm the active lease has picked up the new resolver before testing an install.

Keep reading

  • Troubleshooting

    Fix npm E502 when installing Node-RED nodes behind a proxy

    npm error code E502 on a palette install means an answering hop could not resolve or connect onward to the registry host, even when a generic HTTP check passes. Work the failure upstream from the proxy: confirm the proxy process, match the device's proxy address and mode, check the firewall rule, then verify outbound TCP 443 to registry.npmjs.org. Treat an App Unavailable editor as a missing localhost exception, a separate fault.

    Edge computing and IIoT

  • Troubleshooting

    Node-RED MQTT stuck on connecting inside a Docker container

    A Node-RED MQTT node stuck on connecting means no session was ever established: the transport connection to the server address and port never completed, or the broker declined the client. Test name resolution and routing from inside the container, then set the server to the broker's IP address and the port of its active listener. The controller's own IP works only when a broker actually listens there.

    Edge computing and IIoT

  • Troubleshooting

    Why the InfluxDB node install fails in Node-RED behind a proxy

    A ping from the edge box proves only name resolution and ICMP. The palette install fetches packages over HTTPS with npm, and npm on the device does not inherit the proxy configured on the company modem, so the install fails while the same install works on a Windows PC. Set the proxy in npm on the device, in the account that runs the install, then retry and restart Node-RED.

    Edge computing and IIoT

AVEVA Historian Flex licensing and redundancy credits explained