nodejs/node · error

%s: icu-config not found. Fix PATH or specify -O option\n

Error message

%s: icu-config not found. Fix PATH or specify -O option\n

What it means

Both probes used to locate pkgdata.inc failed: the pkg-config command did not yield a usable pkglibdir, and the fallback icu-config command also failed. pkg_getPkgDataPath returns -1. The message instructs fixing PATH or using the -O option to specify the path to pkgdata.inc directly.

Source

Thrown at deps/icu-small/source/tools/pkgdata/pkgdata.cpp:2185

        return false;
    }

    return true;
}
#endif

/* Get path to pkgdata.inc. Try pkg-config first, falling back to icu-config. */
static int32_t pkg_getPkgDataPath(UBool verbose, UOption *option) {
#if U_HAVE_POPEN
    static char buf[512] = "";
    UBool pkgconfigIsValid = true;
    const char *pkgconfigCmd = "pkg-config --variable=pkglibdir icu-uc";
    const char *icuconfigCmd = "icu-config --incpkgdatafile";
    const char *pkgdata = "pkgdata.inc";

    if (!getPkgDataPath(pkgconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {
        if (!getPkgDataPath(icuconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {
            fprintf(stderr, "%s: icu-config not found. Fix PATH or specify -O option\n", progname);
            return -1;
        }

        pkgconfigIsValid = false;
    }

    for (int32_t length = strlen(buf) - 1; length >= 0; length--) {
        if (buf[length] == '\n' || buf[length] == ' ') {
            buf[length] = 0;
        } else {
            break;
        }
    }

    if (!*buf) {
        fprintf(stderr, "%s: Unable to locate pkgdata.inc. Unable to parse the results of '%s'. Check paths or use the -O option to specify the path to pkgdata.inc.\n", progname, pkgconfigIsValid ? pkgconfigCmd : icuconfigCmd);
        return -1;
    }

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Install ICU development tools (icu-config / libicu-dev / icu4c) and confirm 'icu-config --incpkgdatafile' prints a path.
  2. Add ICU's bin directory to PATH.
  3. Use the -O option to point pkgdata directly at pkgdata.inc (a.k.a. Makefile.inc).
  4. If U_HAVE_POPEN is false on your platform, -O is mandatory.

Example fix

# before: pkgdata cannot self-locate
pkgdata -p mypkg

# after: supply the inc file explicitly
pkgdata -O /opt/icu/lib/icu-67/pkgdata.inc -p mypkg
Defensive patterns

Strategy: validation

Validate before calling

# Make sure at least one locator is usable, else supply -O.
if ! pkg-config --exists icu-uc && ! command -v icu-config >/dev/null; then
  echo "supply -O <path-to-pkgdata.inc>"; exit 1
fi

Prevention

When it happens

Trigger: Neither 'pkg-config --variable=pkglibdir icu-uc' nor 'icu-config --incpkgdatafile' produced output. Both executables are missing from PATH, or popen is unavailable (U_HAVE_POPEN false), or ICU was never installed on the build host.

Common situations: Building against a source-only ICU checkout that was not 'make install'ed; cross-compile environments; stripped-down CI images without icu-dev tools; a PATH that excludes the ICU bin directory.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/9ca40b6757fb3fd4. Report an issue: GitHub.