
node-gyp
A command-line tool that compiles C/C++ native addons for Node.js.
- Stars
- 10.7k
- Forks
- 1.9k
- Licence
- MIT
- Language
- Python
- Last update
- 8 days ago
- Type
- Dev tool
What it is
node-gyp is a command-line tool, written in Node.js, that compiles native addons, which are modules written in C or C++ that Node.js can load. It bundles a copy of the gyp-next build project and downloads the Node.js header files needed for the version you target. It is not used to build Node.js itself.
- Run node-gyp configure and node-gyp build in a folder containing a binding.gyp file to produce a .node binding
- Target a specific Node.js version's headers with the install and list commands
- Pass --dist-url or --nodedir to build an addon against Electron headers
Great for
- Developers publishing or installing Node.js packages that include native C/C++ code
- Maintainers who need one build command to work across Unix, macOS and Windows
- Developers building addons for a specific Node.js version or a third-party runtime such as Electron
Not ideal for
- Projects that contain only JavaScript, since no native compilation is needed
- People trying to build Node.js itself, which the README says node-gyp is not used for
- Developers who cannot install a C/C++ toolchain and Python, since both are required
How to get it
- 1
Install with a package manager
You'll need: Python (a version supported by node-gyp, see the Python devguide) · make and a C/C++ compiler toolchain (GCC, clang, or Visual Studio C++ tools on Windows) · Node.js with npm
Install node-gyp globally with npm
npm install -g node-gypWindows only: install Python and Visual C++ tools via Chocolatey
choco install python visualstudio2026-workload-vctools -y - 2
Run it
- Install node-gyp and its prerequisites for your operating system.
- Change into your addon's root directory, which must contain a binding.gyp file.
- Run node-gyp configure to generate the build files.
- Run node-gyp build to compile; the output appears in build/Release/ or build/Debug/.
- 3
Get the most out of it
- Use --python or the npm_config_python environment variable if you have several Python versions installed
- Use --debug (or -d) with configure, build or rebuild to produce a Debug build
- Use --dist-url or --nodedir when building for runtimes such as Electron
- Install the VSSetup PowerShell module on Windows to make Visual Studio detection more reliable, as the README advises
Downloads
Strengths
- One set of commands works across the supported platforms, according to the README
- Supports all current and LTS Node.js target versions, per the README
- Widely used in the Node.js ecosystem, with about 10.7k GitHub stars
Trade-offs
- Requires a supported Python version plus a working C/C++ compiler, which can be hard to set up on Windows
- Auto-detection of older Visual Studio versions can fail and needs manual flags
- Python 3.12 and later require node-gyp v10 or newer, as noted in the README
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| node-gyp (this) | 10.7k | Dev tool | intermediate | 8 days ago | Developers publishing or installing Node.js packages that include native C/C++ code |
| nodemon | 26.7k | Dev tool | beginner | 4 days ago | Node.js developers running a web server locally who want fast edit-and-reload cycles |
| nvm | 95.7k | Dev tool | beginner | 8 days ago | Developers who work on several Node.js projects that need different versions |
| pnpm | 37k | Dev tool | beginner | 4 days ago | Developers working in Node.js projects who want faster installs and less disk use |
| asdf | 25.6k | Dev tool | beginner | 5 days ago | Developers who work on several projects that need different language versions |
| validator.js | 23.7k | Library | beginner | 2 months ago | JavaScript developers validating form or API input on Node.js |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.