nodejs/node · error

Failed to install data file with command: %s\n

Error message

Failed to install data file with command: %s\n

What it means

In pkg_installCommonMode() (line 1217), the data file copy command failed. After successfully creating or verifying the install directory, the tool builds an install command using pkgDataFlags[INSTALL_CMD] (or WIN_INSTALL_CMD 'xcopy' on Windows MSVC) to copy a data file. runCommand() returned non-zero.

Source

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

    if (!T_FileStream_file_exists(installDir)) {
        UErrorCode status = U_ZERO_ERROR;

        uprv_mkdir(installDir, &status);
        if (U_FAILURE(status)) {
            fprintf(stderr, "Error creating installation directory: %s\n", installDir);
            return -1;
        }
    }
#ifndef U_WINDOWS_WITH_MSVC
    snprintf(cmd, sizeof(cmd), "%s %s %s", pkgDataFlags[INSTALL_CMD], fileName, installDir);
#else
    snprintf(cmd, sizeof(cmd), "%s %s %s %s", WIN_INSTALL_CMD, fileName, installDir, WIN_INSTALL_CMD_FLAGS);
#endif

    result = runCommand(cmd);
    if (result != 0) {
        fprintf(stderr, "Failed to install data file with command: %s\n", cmd);
    }

    return result;
}

#ifdef U_WINDOWS_MSVC
/* Copy commands for installing the raw data files on Windows. */
#define WIN_INSTALL_CMD "xcopy"
#define WIN_INSTALL_CMD_FLAGS "/E /Y /K"
#endif
static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, const char *fileListName) {
    int32_t result = 0;
    char cmd[LARGE_BUFFER_MAX_SIZE] = "";

    if (!T_FileStream_file_exists(installDir)) {
        UErrorCode status = U_ZERO_ERROR;

        uprv_mkdir(installDir, &status);

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Verify the source data file (fileName) exists before the install command runs.
  2. Check write permissions on the install directory.
  3. On Windows MSVC, verify 'xcopy' is available and the flags are appropriate.
  4. Run the printed command manually to identify the OS-level error.
Defensive patterns

Strategy: validation

Validate before calling

// Before installing data files, verify source file and dest directory
#include <unistd.h>
#include <sys/stat.h>

bool verifyFileInstall(const char* srcFile, const char* installDir) {
    if (access(srcFile, 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_installCommonMode() during file-mode or common-mode installation of raw data files. The copy command (cp, install, or xcopy on Windows) for an individual data file to the install directory failed.

Common situations: Source data file doesn't exist; install directory permissions changed; on Windows MSVC, WIN_INSTALL_CMD ('xcopy') or its flags (/E /Y /K) are incompatible with the scenario; disk full; network drive timeout on the install path.

Related errors


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