Registry / devops / bin-build

bin-build

JSON →
library3.0.0jsnpmunverified

The `bin-build` package, currently at version 3.0.0 and last updated approximately nine years ago (around 2017), provides a JavaScript API for programmatically compiling external software from source code. It simplifies the process of downloading, extracting, and executing a sequence of shell commands (e.g., `./configure`, `make`, `make install`) to build binaries from tarball archives fetched from URLs or local files, or directly from source within a specified directory. This utility is valuable for Node.js projects that need to integrate or manage native dependencies or command-line tools as part of their build or installation workflows. Its main advantage lies in abstracting the common compilation patterns and handling archive extraction, offering a more structured approach than direct `child_process` execution. Given its age and lack of recent updates, it appears to be in a maintenance-only state, with no active development.

npm install bin-build
INSTALL
IMPORT
SIG · BIN-BUILD
B
bin-build
devopsjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

binBuild
const binBuild = require('bin-build');
import binBuild from 'bin-build';
The library primarily uses CommonJS `require()` syntax. Direct ESM `import` is not natively supported without a bundler, given its last update was prior to widespread Node.js ESM adoption.
binBuild.url
const binBuild = require('bin-build'); binBuild.url('...', [...]);
import { url } from 'bin-build';
`url` is a method of the main `binBuild` object, not a named export. Ensure the entire `binBuild` object is imported.
binBuild.file
const binBuild = require('bin-build'); binBuild.file('...', [...]);
import { file } from 'bin-build';
`file` is a method of the main `binBuild` object, not a named export. Ensure the entire `binBuild` object is imported.

Demonstrates downloading a tarball from a URL, extracting it, and running a series of build commands to compile a binary into a specified output directory.

const binBuild = require('bin-build'); const path = require('path'); const fs = require('fs'); // Example: Building gifsicle from a URL const gifsicleUrl = 'http://www.lcdf.org/gifsicle/gifsicle-1.80.tar.gz'; const buildCommands = [ './configure --disable-gifview --disable-gifdiff', 'make install' ]; const outputDir = path.join(__dirname, 'built-binaries'); if (!fs.existsSync(outputDir)) { fs.mkdirSync(outputDir); } console.log(`Attempting to build gifsicle from: ${gifsicleUrl}`); binBuild.url(gifsicleUrl, buildCommands, { cwd: outputDir }) .then(() => { console.log('gifsicle built successfully in ' + outputDir); }) .catch(error => { console.error('Failed to build gifsicle:', error.message); console.error('Ensure build tools (like make, configure, tar) are installed and accessible.'); }); // To run this, you would typically need 'tar', 'make', and a C compiler installed on your system.
Debug
Known issues
gotchabin-build relies heavily on external system dependencies such as `tar`, `make`, `configure`, and a C/C++ compiler. These tools must be installed and accessible in the system's PATH where the Node.js process is running. This can lead to cross-platform compatibility issues or failures in environments without these development tools.
fix
Ensure that necessary build tools (e.g., `build-essential` on Debian/Ubuntu, Xcode Command Line Tools on macOS, MSYS2/MinGW on Windows) are installed in the deployment environment.
affects: >=1.0.0
breakingThe package was last published 9 years ago (around 2017) and is effectively unmaintained. This means it may not receive updates for new Node.js versions, security vulnerabilities, or modern JavaScript features (like native ESM). Using unmaintained software can pose security risks and lead to compatibility issues with newer ecosystems.
fix
Carefully audit the package's dependencies and functionality. Consider alternatives for new projects or implement robust error handling and monitoring for existing applications. Evaluate the security implications of running arbitrary commands within your build process.
affects: >=3.0.0
securityWhen using `binBuild.url()` or `binBuild.file()` with arbitrary commands, the package executes shell commands provided as input. If the source URL or commands are untrusted or compromised, this could lead to arbitrary code execution vulnerabilities (supply chain attacks) in your build environment.
fix
Only use `bin-build` with trusted source URLs and thoroughly vetted build commands. Implement strict input validation if any part of the URL or commands is user-controlled. Consider running builds in isolated, disposable environments (e.g., Docker containers) with minimal privileges.
affects: >=1.0.0
gotchaThe package is CommonJS-only (`require`). It does not provide native ECMAScript Module (ESM) exports. Attempting to `import` it directly in an ESM context will result in errors unless a bundler or transpiler is used, or dynamic `import()` with `createRequire` is employed.
fix
For ESM projects, use `const binBuild = require('bin-build');` or `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const binBuild = require('bin-build');`.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Command failed: tar -xzf /tmp/some-archive.tar.gz ... (or similar error with 'tar')
The `tar` utility is not installed or not found in the system's PATH, or the archive file is corrupted/malformed.
fix
Install `tar` on the system (e.g., `sudo apt-get install tar` on Linux, comes with macOS). Verify the archive URL/path is correct and the file is not corrupted.
Error: Command failed: ./configure ... (or similar error with 'make', 'gcc', etc.)
The build command (e.g., `./configure`, `make`) failed because required development tools (compilers, libraries) are missing or configuration steps were incorrect.
fix
Ensure all necessary build tools and libraries are installed for the target binary (e.g., `build-essential` package on Debian/Ubuntu). Consult the upstream project's documentation for specific build requirements.
Error: getaddrinfo ENOTFOUND www.example.com (for binBuild.url)
The host name in the provided URL could not be resolved (DNS error), or there's a network connectivity issue preventing the download.
fix
Check for typos in the URL. Verify network connectivity and DNS resolution. Ensure there are no firewall rules blocking the request.
TypeError: binBuild.url is not a function (or .file, .directory)
The `binBuild` object was imported incorrectly or `require('bin-build')` returned an unexpected value (e.g., in an ESM context without proper interoperability).
fix
Ensure `const binBuild = require('bin-build');` is used in a CommonJS context. If in ESM, consider `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const binBuild = require('bin-build');`.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
bin-build — npm install bin-build · libregistry