Registry / devops / nw-gyp

nw-gyp

JSON →
library3.6.8jsnpmunverified

nw-gyp is a specialized build tool designed to compile native Node.js addons for use within NW.js (formerly node-webkit) applications. It functions as a 'hack' on `node-gyp`, adapting its build process to accommodate the specific headers and libraries required by NW.js, which often uses a different V8 version than standard Node.js. The current stable version is 3.6.8, last published 10 months ago, but the project's GitHub repository shows no significant activity since 2017. This indicates the tool is largely abandoned and is highly unlikely to be compatible with recent versions of NW.js or Node.js. Developers must manually specify the target NW.js version during the configuration step.

npm install nw-gyp
INSTALL
IMPORT
SIG · NW-GYP
N
nw-gyp
devopsjavascriptv3.6.8
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.

configure
const { configure } = require('nw-gyp/lib/nw-gyp');
import { configure } from 'nw-gyp';
nw-gyp is a CommonJS CLI tool and does not provide official ESM exports. Direct programmatic access to internal functions like `configure` is possible via internal CJS module paths but is not officially supported and is prone to breaking changes. This pattern is generally for highly advanced, non-standard use cases.
build
const { build } = require('nw-gyp/lib/nw-gyp');
import { build } from 'nw-gyp';
Similar to `configure`, this accesses an internal CJS function for building. The primary and recommended method of using nw-gyp is through its command-line interface, not programmatic `require` calls.
clean
const { clean } = require('nw-gyp/lib/nw-gyp');
import { clean } from 'nw-gyp';
This also targets an internal CJS function. For typical use, invoke `nw-gyp clean` from the command line.

Demonstrates the global installation, configuration, and build steps for a native NW.js addon using the nw-gyp command-line interface, targeting an older, compatible NW.js version.

# Install nw-gyp globally (recommended for CLI tools) npm install -g nw-gyp # Navigate to your native addon's root directory # This directory should contain your 'binding.gyp' file. cd my_native_nwjs_addon # Configure the build for a specific NW.js version # NOTE: nw-gyp is abandoned and primarily compatible with older NW.js/Node.js versions. # For example, NW.js v0.12.3 bundled Node.js 0.12.x. # Using a modern NW.js target will likely fail. `--arch` and `--msvs_version` (for Windows) # are often necessary for correct configuration. nw-gyp configure --target=0.12.3 --arch=x64 --msvs_version=2015 # Build the native addon nw-gyp build # The compiled '.node' file will be located in 'build/Release/' or 'build/Debug/' # You can then require it in your NW.js application: # const myAddon = require('./build/Release/my_addon.node'); # console.log(myAddon.someFunction());
nw-gyp --version
Debug
Known issues
breakingThe `nw-gyp` project is abandoned with no significant updates since 2017. It is highly unlikely to be compatible with recent versions of NW.js or Node.js. Attempting to use it with modern environments will almost certainly result in build failures due to ABI incompatibility, Python 3 incompatibility, and updated compiler requirements.
fix
For newer NW.js projects, consider using `node-gyp` directly with appropriate flags, or explore alternative solutions if `node-gyp` itself proves insufficient for NW.js specific requirements in newer versions. Consult the official NW.js documentation for current recommendations on native module support.
affects: >=3.0.0
gotchanw-gyp strictly requires Python 2.7. Python 3.x is explicitly NOT supported and will cause build failures.
fix
Ensure Python 2.7 is installed and configured correctly in your system's PATH. If you have multiple Python versions, specify Python 2.7 using `nw-gyp --python /path/to/python2.7` or `npm config set python /path/to/executable/python2.7`.
affects: >=0.1.0
gotchaBuilding native modules for NW.js requires specific system-level build tools, including `make` (on Unix-like systems) and a C/C++ compiler toolchain (GCC, Xcode, or Visual C++). These tools are not bundled and must be installed manually, which can be complex, especially on Windows.
fix
Follow the installation instructions in the README for your specific operating system. On Windows, consider using `npm install --global --production windows-build-tools` from an elevated prompt to automate the setup. Ensure your Xcode Command Line Tools are installed and up-to-date on macOS.
affects: >=0.1.0
gotchaYou must manually specify the target NW.js version using the `--target=<version>` flag during the `configure` step. Auto-detection is not reliable, and failing to specify a compatible version will result in build errors or runtime instability.
fix
Always include `--target=<NW.js_version_you_are_using>` (e.g., `--target=0.12.3`) when running `nw-gyp configure`. Also consider `--arch=x64` or `--arch=ia32` and, on Windows, `--msvs_version=<year>` for robust configuration.
affects: >=0.3.2
Errors
Common errors & fixes
gyp ERR! find Python: Python is not set from command line or npm config.
nw-gyp cannot locate a Python 2.7 executable on your system, or it's trying to use an unsupported Python 3.x version.
fix
Install Python 2.7, add it to your PATH, and then explicitly set its path: `npm config set python /path/to/python2.7` or run `nw-gyp --python /path/to/python2.7 ...`
gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: X
The C/C++ compiler or `make` toolchain is either not installed, incorrectly configured, or there's a problem with your `binding.gyp` file or source code.
fix
Ensure `make` and a compatible C/C++ compiler (GCC, Xcode, Visual C++) are properly installed and accessible in your system's PATH according to your OS's requirements. Verify your `binding.gyp` syntax and C/C++ code.
gyp ERR! stack Error: Could not find any Visual Studio installation to use.
On Windows, nw-gyp could not detect a compatible Visual C++ Build Tools installation (e.g., Visual Studio 2015 Build Tools).
fix
Install Visual C++ Build Tools 2015 (or a version compatible with your NW.js target and nw-gyp version). Use `npm install --global --production windows-build-tools` or manually install Visual Studio 2015/2017 with the 'Common Tools for Visual C++' workload. Then, try setting `npm config set msvs_version 2015` or similar.
gyp ERR! configure error gyp ERR! stack Error: Missing Node.js development headers.
nw-gyp failed to download or locate the necessary Node.js headers for the specified `--target` NW.js version, usually due to network issues, incorrect target, or an obscure NW.js version.
fix
Verify your `--target` NW.js version is correct and accessible. Check your internet connection. If behind a proxy, configure `npm` and your system's proxy settings. Ensure the target version's headers are still available from NW.js build servers.
gyp: Undefined variable standalone_static_library in binding.gyp
This error often occurs when trying to build an old native module with a newer nw-gyp (or node-gyp), or when the `binding.gyp` file contains outdated or incompatible GYP variables for the target environment.
fix
This specific issue indicates deep incompatibility. As `nw-gyp` is abandoned, this usually means the native module and `nw-gyp` are too far out of sync. Upgrading the native module or attempting to use a significantly older version of `nw-gyp` that matches the module's vintage might be the only (unlikely) solution. Generally, it signals a breaking change due to the abandonment status.
Upgrade
Version history
3.6.8latest on npm
Audit
Dependencies
pythonrequiredRequired for the underlying gyp build system. Only v2.7 is supported; v3.x.x is explicitly NOT supported.
makerequiredStandard build utility required on Unix-like systems (Linux, macOS) for compiling C/C++ code.
C/C++ compiler toolchainrequirede.g., GCC on Linux, Xcode Command Line Tools on macOS, or Visual C++ Build Tools on Windows, necessary for compiling native code.
windows-build-toolsoptionalOptional npm package on Windows to simplify the installation of required Visual C++ build environment and Python 2.7.
Agent activity
4 hits · last 30 days
node
4
Resources