{"record":{"id":"ea599e3feb1b95a9","repo":"nodejs/node","slug":"error-installing-library-failed-command-s-n","errorCode":null,"errorMessage":"Error installing library. Failed command: %s\\n","messagePattern":"Error installing library\\. Failed command: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/pkgdata/pkgdata.cpp","lineNumber":1163,"sourceCode":"\nstatic int32_t pkg_installLibrary(const char *installDir, const char *targetDir, UBool noVersion) {\n    int32_t result = 0;\n    char cmd[LARGE_BUFFER_MAX_SIZE];\n\n    auto ret = snprintf(cmd,\n            sizeof(cmd),\n            \"cd %s && %s %s %s%s%s\",\n            targetDir,\n            pkgDataFlags[INSTALL_CMD],\n            libFileNames[LIB_FILE_VERSION],\n            installDir, PKGDATA_FILE_SEP_STRING, libFileNames[LIB_FILE_VERSION]);\n    (void)ret;\n    U_ASSERT(0 <= ret && ret < SMALL_BUFFER_MAX_SIZE);\n\n    result = runCommand(cmd);\n\n    if (result != 0) {\n        fprintf(stderr, \"Error installing library. Failed command: %s\\n\", cmd);\n        return result;\n    }\n\n#ifdef CYGWINMSVC\n    snprintf(cmd, sizeof(cmd), \"cd %s && %s %s.lib %s\",\n            targetDir,\n            pkgDataFlags[INSTALL_CMD],\n            libFileNames[LIB_FILE],\n            installDir\n            );\n    result = runCommand(cmd);\n\n    if (result != 0) {\n        fprintf(stderr, \"Error installing library. Failed command: %s\\n\", cmd);\n        return result;\n    }\n#elif U_PLATFORM == U_PF_CYGWIN\n    snprintf(cmd, sizeof(cmd), \"cd %s && %s %s %s\",","sourceCodeStart":1145,"sourceCodeEnd":1181,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/pkgdata/pkgdata.cpp#L1145-L1181","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create the install directory and verify write permissions.","Check pkgDataFlags[INSTALL_CMD] is a valid command.","Verify the versioned library exists in targetDir.","Run the printed command manually to see the OS error."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before installing the library, verify source and destination\n#include <unistd.h>\n#include <sys/stat.h>\n\nbool verifyInstallPaths(const char* targetDir, const char* installDir, const char* libFile) {\n    char src[1024];\n    snprintf(src, sizeof(src), \"%s/%s\", targetDir, libFile);\n    if (access(src, R_OK) != 0) return false;\n    struct stat st;\n    if (stat(installDir, &st) != 0 || !S_ISDIR(st.st_mode)) return false;\n    return access(installDir, W_OK) == 0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create the install directory and verify write permissions before building.","Confirm the versioned library exists in targetDir.","Validate pkgDataFlags[INSTALL_CMD] is a valid command."],"tags":["icu","pkgdata","install","shell-command","permissions","build-tool"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}