nodejs/node · error

Error installing the data library.\n

Error message

Error installing the data library.\n

What it means

pkg_installLibrary() returned non-zero during the top-level install phase (line 840). This function copies the built data library to the install directory using the install command from pkgDataFlags[INSTALL_CMD], then creates symlinks. A failure here means the copy command or subsequent symlink creation failed.

Source

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

#endif
                    if (result != 0) {
                        fprintf(stderr, "Error creating symbolic links of the data library file.\n");
                        return result;
                    }
                }
#endif
            } /* !IN_STATIC_MODE */
#endif

#if !U_PLATFORM_USES_ONLY_WIN32_API
            /* Install the libraries if option was set. */
            if (o->install != nullptr) {
                if(o->verbose) {
                  fprintf(stdout, "# Installing library file to %s ..\n", o->install);
                }
                result = pkg_installLibrary(o->install, targetDir, noVersion);
                if (result != 0) {
                    fprintf(stderr, "Error installing the data library.\n");
                    return result;
                }
            }
#endif
        }
    }
    return result;
}

/* Initialize the pkgDataFlags with the option file given. */
static int32_t initializePkgDataFlags(UPKGOptions *o) {
    UErrorCode status = U_ZERO_ERROR;
    int32_t result = 0;
    int32_t currentBufferSize = SMALL_BUFFER_MAX_SIZE;
    int32_t tmpResult = 0;

    /* Initialize pkgdataFlags */
    pkgDataFlags = static_cast<char**>(uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE));

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Create the install directory beforehand and verify write permissions.
  2. Ensure the versioned library exists in the target directory before running pkgdata with --install.
  3. Check pkgDataFlags[INSTALL_CMD] is a valid command ('install', 'cp', etc.).
  4. Run the printed command manually to identify the OS-level error.
Defensive patterns

Strategy: validation

Validate before calling

// Before installing, check the install directory exists and is writable
#include <unistd.h>
#include <sys/stat.h>

bool checkInstallDir(const char* dir) {
    struct stat st;
    if (stat(dir, &st) != 0) return false;  // must exist
    if (!S_ISDIR(st.st_mode)) return false;
    if (access(dir, W_OK) != 0) return false;
    return true;
}

Prevention

When it happens

Trigger: Called when o->install is non-null on non-Win32 platforms and the mode is not static (the static path is handled separately at line 753). The install command (typically 'cp' or 'install') for the versioned library file failed via system().

Common situations: Install directory doesn't exist or lacks write permissions; insufficient disk space; the versioned library file in targetDir is missing; INSTALL_CMD not set correctly in the options file.

Related errors


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