nodejs/node · error

Error installing library. Failed command: %s\n

Error message

Error installing library. Failed command: %s\n

What it means

In pkg_installLibrary() (line 1146), the primary library install command failed. The command copies the versioned library from targetDir to installDir using pkgDataFlags[INSTALL_CMD] (typically 'cp' or 'install'). runCommand() returned non-zero, meaning the copy failed.

Source

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

static int32_t pkg_installLibrary(const char *installDir, const char *targetDir, UBool noVersion) {
    int32_t result = 0;
    char cmd[LARGE_BUFFER_MAX_SIZE];

    auto ret = snprintf(cmd,
            sizeof(cmd),
            "cd %s && %s %s %s%s%s",
            targetDir,
            pkgDataFlags[INSTALL_CMD],
            libFileNames[LIB_FILE_VERSION],
            installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]);
    (void)ret;
    U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);

    result = runCommand(cmd);

    if (result != 0) {
        fprintf(stderr, "Error installing library. Failed command: %s\n", cmd);
        return result;
    }

#ifdef CYGWINMSVC
    snprintf(cmd, sizeof(cmd), "cd %s && %s %s.lib %s",
            targetDir,
            pkgDataFlags[INSTALL_CMD],
            libFileNames[LIB_FILE],
            installDir
            );
    result = runCommand(cmd);

    if (result != 0) {
        fprintf(stderr, "Error installing library. Failed command: %s\n", cmd);
        return result;
    }
#elif U_PLATFORM == U_PF_CYGWIN
    snprintf(cmd, sizeof(cmd), "cd %s && %s %s %s",

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Create the install directory and verify write permissions.
  2. Check pkgDataFlags[INSTALL_CMD] is a valid command.
  3. Verify the versioned library exists in targetDir.
  4. Run the printed command manually to see the OS error.
Defensive patterns

Strategy: validation

Validate before calling

// Before installing the library, verify source and destination
#include <unistd.h>
#include <sys/stat.h>

bool verifyInstallPaths(const char* targetDir, const char* installDir, const char* libFile) {
    char src[1024];
    snprintf(src, sizeof(src), "%s/%s", targetDir, libFile);
    if (access(src, R_OK) != 0) return false;
    struct stat st;
    if (stat(installDir, &st) != 0 || !S_ISDIR(st.st_mode)) return false;
    return access(installDir, W_OK) == 0;
}

Prevention

When it happens

Trigger: Called from pkg_installLibrary() with the default platform code path (not CYGWINMSVC, not Cygwin, not OS/390). The install command for the versioned library failed. This is the main install path on Linux, macOS, and other Unix.

Common situations: Install directory doesn't exist or lacks write permissions; INSTALL_CMD is misconfigured in the options file; the source library file doesn't exist in targetDir; insufficient disk space in installDir; installDir path is invalid.

Related errors


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