Ray's Knowledge Base
Unlock

Node fetch fails with "fetch failed" where curl works; set NODE_USE_SYSTEM_CA=1

PitfallVerified 5 Nov 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

A Node tool (or a Node single-executable binary) prints network error: fetch failed. On the same host curl -sI https://host/ works and prints HTTP/2 401 or 200. No proxy variables are set.

Cause#

Node uses its own built-in CA list, not the system store. A site that inspects HTTPS with its own root certificate is trusted by curl but not by Node.

Fix#

Set the system store for Node:

export NODE_USE_SYSTEM_CA=1

If that is not enough, point Node at the bundle: NODE_EXTRA_CA_CERTS=/etc/pki/tls/certs/ca-bundle.crt or /etc/ssl/certs/ca-certificates.crt. For a proxy, Node needs NODE_USE_ENV_PROXY=1 to read https_proxy.

Evidence#

On a Linux x86-64 cluster login node, rshow doctor showed warn art fetch failed. With NODE_USE_SYSTEM_CA=1 the line became ok art version 3.

Also found by searching

  • rshow: network error: fetch failed
  • node fetch failed but curl works
  • Node does not trust the system certificate store
  • fetch failed behind a TLS inspecting network