Registry / devops / node-gyp-build-mobile

node-gyp-build-mobile

JSON →
library4.6.0-3jsnpmunverified

This package, `node-gyp-build-mobile`, serves as a specialized fork of the widely used `node-gyp-build` utility, meticulously adapted for the Node.js Mobile ecosystem. Its primary function is to override standard npm defaults, thereby enabling `node-mobile-gyp` to successfully compile native Node.js addons specifically for deployment on mobile platforms. The current stable version, `4.6.0-3`, reflects a unique versioning scheme that deviates from traditional Semantic Versioning. Instead, `x.y.z-a` indicates that the package is based on upstream `node-gyp-build` version `x.y.z`, with the `a` component acting as an internal incrementer for `node-gyp-build-mobile`'s own releases. This ensures compatibility and specific optimizations required for the mobile Node.js runtime. As a core component, it is essential for developers engaged in building and integrating C++ or other native modules within Node.js Mobile applications, providing the necessary build-time environment to correctly locate and link prebuilt binaries or compile source code against the target mobile architecture.

npm install node-gyp-build-mobile
INSTALL
IMPORT
SIG · NODE-GYP-BUILD-MOB
N
node-gyp-build-mobile
devopsjavascriptv4.6.0-3
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.

findNativeAddon
import findNativeAddon from 'node-gyp-build-mobile';
import { findNativeAddon } from 'node-gyp-build-mobile';
The package exports a single function as its default export, which is used internally to locate or build native addon binaries. It's typically consumed by other build tools or within the native module's main entry point, not usually by application code directly.
findNativeAddon (CJS)
const findNativeAddon = require('node-gyp-build-mobile');
const { findNativeAddon } = require('node-gyp-build-mobile');
For CommonJS environments, the package's default function export is assigned directly. This function is invoked with the native module's `__dirname` to resolve the native addon binary.
CLI Usage
"install": "node-gyp-build-mobile --fallback-to-build"
The primary interaction is often via `package.json` scripts, where `node-gyp-build-mobile` is invoked as a command-line tool to manage native addon compilation and prebuild loading.

Demonstrates how to integrate `node-gyp-build-mobile` into a `package.json` `install` script to build or locate a native addon for Node.js Mobile, and how the addon's main file uses `node-gyp-build-mobile` to load itself at runtime.

{ "name": "my-mobile-native-module", "version": "1.0.0", "description": "A native Node.js Mobile module that uses node-gyp-build-mobile.", "main": "index.js", "scripts": { "install": "node-gyp-build-mobile --fallback-to-build", "test-mobile-load": "node index.js" }, "dependencies": { "node-gyp-build-mobile": "^4.6.0-3" }, "keywords": [ "nodejs-mobile", "native-addon", "gyp", "build" ] } // index.js (within the native module package) const path = require('path'); const findAddon = require('node-gyp-build-mobile'); let myNativeModule; try { // The findAddon function takes the directory of the package.json for the native module myNativeModule = findAddon(__dirname); console.log('Native module loaded successfully for Node.js Mobile.'); // Example: If the native module exports a 'greet' function // if (typeof myNativeModule.greet === 'function') { // console.log('Greeting from native module:', myNativeModule.greet('Mobile User')); // } } catch (error) { console.error('Failed to load native module for Node.js Mobile:', error.message); console.error('Ensure node-gyp-build-mobile ran successfully during install.'); process.exit(1); } // Log the loaded module (could be an object or a function depending on native addon) console.log('Loaded native module object:', myNativeModule);
Debug
Known issues
gotchaThis package does not follow standard Semantic Versioning. Its version `x.y.z-a` indicates it is based on upstream `node-gyp-build` version `x.y.z`, with `a` being an incrementer for its own releases. This means `minor` or `patch` changes in `node-gyp-build-mobile` might not directly correspond to `node-gyp-build`'s SemVer.
fix
Always check the release notes for `node-gyp-build-mobile` specifically when updating, as behavior changes may not align with upstream SemVer expectations.
affects: >=1.0.0
breakingThis package is specifically designed for Node.js Mobile and is not compatible with standard Node.js environments. Attempting to use it outside of a Node.js Mobile project will likely result in build failures or runtime errors.
fix
Ensure your project is configured for Node.js Mobile development and that `node-mobile-gyp` is correctly installed and set up as the native addon build tool.
affects: >=1.0.0
gotchaSuccessful operation requires a complete native build toolchain (C++ compiler, Python, etc.) correctly configured for the target mobile platform, as managed by `node-mobile-gyp`.
fix
Refer to the `nodejs-mobile` and `node-mobile-gyp` documentation for detailed instructions on setting up the native build environment for your specific mobile platform (iOS/Android).
affects: >=1.0.0
breakingBreaking changes from the upstream `node-gyp-build` package are likely to be inherited. Always consult the `node-gyp-build` changelog alongside `node-gyp-build-mobile`'s specific updates.
fix
Thoroughly test native modules after any updates to `node-gyp-build-mobile` or underlying build toolchain components.
affects: >=1.0.0
Errors
Common errors & fixes
Error: No prebuilt binaries found for [...] and no source files to build.
The package could not find a precompiled native binary for the current architecture/platform, and was unable to compile from source (often due to missing build tools or incorrect configuration).
fix
Ensure your `package.json` `scripts.install` command is correctly configured to run `node-gyp-build-mobile --fallback-to-build` and that all required native build tools (compilers, Python) are installed and accessible for your Node.js Mobile environment.
gyp ERR! build error
A general error occurred during the native module compilation process, typically indicating issues with C++ source code, compiler setup, or gyp file configuration.
fix
Examine the full output of the `gyp ERR!` message for specific clues. Verify your native module's `binding.gyp` file is correct, source code compiles on the target platform, and `node-mobile-gyp` is properly configured.
Error: Cannot find module './build/Release/my-addon.node'
The native addon was either not built successfully, or `node-gyp-build-mobile` failed to locate the compiled `.node` file.
fix
Check the `install` script output for errors. Verify the `build` directory (or equivalent) contains the compiled `.node` file for your target mobile architecture. Ensure `require('node-gyp-build-mobile')(__dirname)` is correctly pointing to the native module's root directory.
Upgrade
Version history
4.6.0-3latest on npm
Audit
Dependencies
node-mobile-gyprequiredRequired for compiling native addons specifically for Node.js Mobile environments, which this package supports.
Agent activity
2 hits · last 30 days
node
2
Resources
node-gyp-build-mobile — npm install node-gyp-build-mobile · libregistry