“npm error code ENOTFOUND” on Mac

ENOTFOUND reports a failed DNS lookup. Node.js documentation calls it “DNS lookup failed”, a failure of either EAI_NODATA or EAI_NONAME.

Fix this with your agentCopies a prompt for Claude Code, Codex or any agent that can use Terminal.

My Mac has this problem: “npm error code ENOTFOUND” on Mac. Read https://kilobat.app/guides/npm-enotfound.md and work through it with me. Install the Kilobat CLI if it’s missing: brew install seifip/kilobat/kilobat. Run the guide’s Terminal and kilobat checks yourself and tell me what you find. List the steps only I can do. Ask before you change any setting.

Applies to: npm 10 and later print “npm error”. Older versions print “npm ERR!”. Node.js on all current macOS versions.Checked: 29 October 2026

Symptoms

  • npm install stops with npm error code ENOTFOUND.
  • The next line names a host, such as registry.npmjs.org.
  • Browsers may work.

Likely causes

  • No connection or DNS. The Mac cannot reach a DNS server.
  • A wrong registry. The npm registry setting names a host that does not exist or that needs a VPN.
  • A VPN with its own DNS. Company registries resolve only while the VPN is on.
  • A proxy npm does not use. On proxy-only networks, npm needs the proxy settings.

How to check

  1. Show the registry that npm uses.

    npm config get registry
  2. Resolve the host name through macOS.

    dscacheutil -q host -a name registry.npmjs.org
  3. Ask the registry directly.

    npm ping
  4. Show the proxy settings.

    npm config get https-proxy

How to fix it

  1. If the macOS lookup fails, fix DNS. See DNS not resolving on a Mac.

  2. Correct the registry.

    npm config set registry https://registry.npmjs.org/
  3. Connect the VPN for a company registry.

  4. Flush the DNS cache. See Flush the DNS cache on a Mac.

With Kilobat

  1. Kilobat's connection doctor tests the address layer by layer: network, proxy, DNS, rules, IPv4, IPv6, TLS and the server. It names the layer that failed.

    kilobat why https://registry.npmjs.org/
  2. These Kilobat checks are free. AI agents run them through MCP with diagnose_connection and diagnose_network. See Find why one site or API won't connect.

Questions

Is ENOTFOUND the same as EAI_AGAIN?

No. EAI_AGAIN reports a temporary lookup failure. See EAI_AGAIN on Mac.

Is my package name wrong?

Rarely. ENOTFOUND concerns a host name, not a package name.

Sources

Checked on 29 October 2026.