node-abi is a utility library designed to retrieve and match Node.js and Electron Application Binary Interface (ABI) versions with their corresponding target versions and runtimes. It is critical for developers working with native Node.js modules that need to be compiled against specific Node.js or Electron environments, ensuring compatibility and preventing runtime errors due to ABI mismatches. The package maintains a comprehensive and frequently updated registry of ABI data. Currently, the stable version is 4.28.0, with a parallel 3.x branch (e.g., 3.89.0) also being actively maintained. Releases are frequent, typically occurring multiple times a month, primarily to incorporate the latest ABI changes from new Node.js and Electron releases. Its key differentiator is its consistent and up-to-date ABI registry, making it an indispensable tool for projects utilizing `node-gyp` or similar native module compilation processes, especially within the Electron ecosystem.
npm install node-abiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `node-abi` to retrieve ABI versions for given Node.js and Electron target versions, find target versions from ABIs, and inspect the underlying ABI map, covering common use cases for native module compatibility.
Ensure your project's Node.js and Electron environments meet the minimum requirements for `node-abi` v4.x. If you need to support older runtimes, consider using a compatible `node-abi` v3.x release.
Always check the `node-abi` release notes or documentation to determine the appropriate major version for your specific Node.js or Electron runtime environment before installing.
Regularly update `node-abi` to its latest patch or minor version (`npm update node-abi` or `yarn upgrade node-abi`) to ensure you have the most current ABI definitions.
Always provide the `runtime` parameter (e.g., `'node'` or `'electron'`) corresponding to the environment your native module is targeting or running in.
Ensure you are using named imports: `import { getAbi } from 'node-abi';` or for CommonJS: `const { getAbi } = require('node-abi');`. The package does not have a default export.Update `node-abi` to the latest version (`npm install node-abi@latest` or `yarn upgrade node-abi`). If the issue persists, ensure you are using the correct major version of `node-abi` for your project's runtime compatibility.
Install the package using your package manager: `npm install node-abi` or `yarn add node-abi`.
Recompile the native module using `node-gyp` or `electron-rebuild` with the correct `target` and `runtime` flags that match your intended deployment environment. Verify `node-abi` is up-to-date and correctly integrated into your build scripts.
No dependency data recorded yet.