node-gyp: Node.js native addon build tool
Compiles native C/C++ addons for Node.js.
Learn more about node-gyp
node-gyp is a cross-platform command-line tool that compiles native C and C++ addon modules for Node.js by wrapping the GYP build configuration system. It abstracts platform-specific compiler toolchains by generating appropriate build files for the target operating system, invoking Visual Studio build tools on Windows, make on Unix-like systems, and Xcode on macOS. The tool automatically detects and configures the correct Node.js headers and libraries needed for the native code to interface with the V8 JavaScript engine and Node.js APIs. It handles the complete build pipeline from parsing gyp configuration files through compiler invocation to producing dynamically loadable binary modules with platform-specific extensions. The architecture prioritizes compatibility across diverse development environments while managing the complexity of native compilation dependencies and toolchain variations.
Cross-platform build abstraction
Provides unified build commands that work on Unix, macOS, and Windows without requiring platform-specific configuration changes. Handles differences in compiler toolchains and build systems across operating systems.
Version-specific targeting
Supports building against different Node.js versions by automatically downloading and managing the appropriate development headers. Allows developers to compile addons for versions other than the currently installed Node.js runtime.
Vendored gyp implementation
Includes a self-contained copy of gyp-next rather than relying on external dependencies. This approach reduces setup complexity and ensures consistent build behavior across different development environments.
const gyp = require('node-gyp')();
// Build native addon programmatically
gyp.parseArgv(['rebuild']);
gyp.todo.forEach((command) => {
gyp.commands[command.name](command.args, (err) => {
if (err) console.error('Build failed:', err);
else console.log('Build completed successfully');
});
});Node-gyp v12.2.0 includes package version logging, gyp-next updates, and various platform improvements.
- –Include built package version in error logs
- –Update gyp-next to v0.21.1
- –Fix CPU concurrency detection on some platforms
- –Python is no longer a valid npm config setting
- –Switch to URL instead of url.parse
Add support for Visual Studio 2026 (18.x).
- –Add support for Visual Studio 2026 (18.x)
Node-gyp v12.0.0 aligns with npm 11 node engine requirements and updates dependencies.
- –Align to npm 11 node engine range
- –Update gyp-next to v0.21.0
- –Bump env-paths from 2.2.1 to 3.0.0
Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
CXX
Safe FFI library for calling C++ from Rust and vice versa with zero-overhead bindings via code generation.
Monaco Editor
Web-based code editor powering VS Code with syntax highlighting and IntelliSense.
FlameGraph
Converts profiling data into interactive SVG flame graphs for performance analysis.
open-directory
Command-line search engine for indexed open directories.
asdf
Unified CLI for managing multiple language runtime versions, replacing nvm, rbenv, pyenv with one tool.