{"id":14737,"library":"node-ninja","title":"Node-ninja: Native Addon Build Tool","description":"Node-ninja is a cross-platform command-line utility for compiling Node.js native addon modules. It serves as a fork of node-gyp, bundling the gyp project used by the Chromium team, with the long-term, unfulfilled goal of transitioning to the Ninja build system. The tool aims to simplify the process of building native modules across different platforms and supports compiling for multiple Node.js ABI versions by downloading necessary development headers. The current stable version is 1.0.2. Its release cadence is effectively non-existent, as the last release is considerably old, targeting historical Node.js versions (e.g., 0.8, 0.9, 0.10, 1.0) and Python 2.7. Key differentiators from upstream node-gyp, at the time of its last development, included better support for projects with multiple gyp files and incremental builds for prebuilds. However, it is now largely superseded by the actively maintained `node-gyp` and appears to be an abandoned project.","status":"abandoned","version":"1.0.2","language":"javascript","source_language":"en","source_url":"git://github.com/codejockey/node-ninja","tags":["javascript","native","addon","module","c","c++","bindings","gyp"],"install":[{"cmd":"npm install node-ninja","lang":"bash","label":"npm"},{"cmd":"yarn add node-ninja","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-ninja","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"node-ninja is a command-line interface (CLI) tool and is not intended for programmatic import into JavaScript/TypeScript files. It is installed globally via npm and executed from the terminal.","symbol":"node-ninja","correct":"n/a (CLI tool)"}],"quickstart":{"code":"// This JavaScript snippet describes how to use the node-ninja CLI tool.\n// node-ninja itself is not imported into JavaScript applications but executed from the terminal.\n\nconsole.log(\"First, install node-ninja globally via npm:\");\nconsole.log(\"  npm install -g node-ninja\");\n\nconsole.log(\"\\nOnce installed, navigate to your native addon project directory.\");\nconsole.log(\"For example, if your project is 'my-native-addon':\");\nconsole.log(\"  cd my-native-addon\");\n\nconsole.log(\"\\nThen, configure your native addon project. This step generates build files (e.g., Makefiles):\");\nconsole.log(\"  node-ninja configure\");\n\nconsole.log(\"\\nFinally, build your native addon. This compiles your C/C++ source code:\");\nconsole.log(\"  node-ninja build\");\n\nconsole.log(\"\\nTo build for a specific Node.js target version (useful for prebuilds):\");\nconsole.log(\"  node-ninja rebuild --target=0.10.0\");\n\nconsole.log(\"\\nEnsure you have system dependencies like Python 2.7 and a C/C++ toolchain installed.\");","lang":"javascript","description":"Demonstrates the typical command-line installation and usage flow for `node-ninja` to configure and build a native Node.js addon."},"warnings":[{"fix":"Ensure Python 2.7 is installed and accessible in your system's PATH. On Windows, verify the `PYTHON` environment variable points to `python.exe` for Python 2.7. You may need to manage Python versions carefully using tools like `pyenv` or `conda`.","message":"node-ninja (and its underlying gyp dependency) strictly requires Python 2.7. It does NOT support Python 3.x, which is the current default for most operating systems. Using Python 3 will lead to build failures.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Consider migrating your native addons to use `node-gyp`, which is the officially maintained build tool for Node.js native addons and receives regular updates. Be aware that this project is effectively abandoned.","message":"The underlying `gyp` project, which node-ninja bundles and relies on, has been archived by Chromium and is no longer actively maintained. This means node-ninja builds rely on an unmaintained core dependency, posing potential compatibility and security risks for newer Node.js versions or operating systems.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"For new projects or existing projects requiring modern Node.js support, it is strongly recommended to use `node-gyp` instead. For legacy projects, proceed with caution, anticipating potential build environment issues.","message":"The `node-ninja` project itself appears to be abandoned. The last release (v1.0.2) is significantly old, targeting historical Node.js versions, and the README explicitly states parts are out of date. This implies no active development, bug fixes, or compatibility updates for modern Node.js environments or operating systems.","severity":"gotcha","affected_versions":"all"},{"fix":"Carefully follow the installation instructions in the README for your specific Windows version, ensuring you install the correct Visual Studio edition (e.g., 2015 Community) and select the C++ development workloads during installation. Set `GYP_MSVS_VERSION` environment variable if necessary.","message":"Building native addons on Windows often requires specific versions of Microsoft Visual C++ (MSVC). Incorrect or missing MSVC installations (e.g., needing 2013 or 2015 Community Edition with C++ tools) can lead to build failures.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Install Python 2.7 and ensure it's accessible in your system's PATH. On Windows, set the `PYTHON` environment variable to the full path of your `python.exe` for Python 2.7.","cause":"Python 2.x is not installed, not correctly configured in PATH, or Python 3.x is being used instead of Python 2.7.","error":"gyp: Undefined variable PYTHON_VERSION in common.gypi while evaluating conditions. Make sure to specify a Python version via the PYTHON environment variable."},{"fix":"Install the required version of Microsoft Visual Studio (e.g., 2013, 2015 Community Edition) with the C++ development components. Ensure you open the command prompt via 'Developer Command Prompt for VS' or that relevant environment variables like `GYP_MSVS_VERSION` are set.","cause":"Microsoft Visual C++ build tools (which include MSBuild) are not installed, or their path is not correctly configured in the environment variables for `node-ninja` to find them on Windows.","error":"'msbuild.exe' is not recognized as an internal or external command, operable program or batch file."},{"fix":"On Linux, install `build-essential` (e.g., `sudo apt-get install build-essential`). On macOS, install Xcode from the App Store and then install its Command Line Tools via `xcode-select --install`.","cause":"The `make` utility or a proper C/C++ compiler toolchain (like GCC on Linux or Xcode Command Line Tools on macOS) is not installed or not in the system's PATH.","error":"make: command not found"}],"ecosystem":"npm"}