electron-native-addon-builder — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited electron-native-addon-builder (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Build and bundle native Node.js addons for Electron with proper ABI (Application Binary Interface) compatibility. This skill handles the complexity of native module compilation, cross-platform building, and ensuring modules work correctly with Electron's Node.js version.
{
"type": "object",
"properties": {
"projectPath": {
"type": "string",
"description": "Path to the Electron project root"
},
"nativeModules": {
"type": "array",
"description": "List of native modules to handle",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"version": { "type": "string" },
"source": { "enum": ["npm", "local", "github"] }
}
}
},
"electronVersion": {
"type": "string",
"description": "Target Electron version"
},
"targetPlatforms": {
"type": "array",
"items": { "enum": ["win32", "darwin", "linux"] }
},
"targetArchitectures": {
"type": "array",
"items": { "enum": ["x64", "arm64", "ia32"] }
},
"useNAPI": {
"type": "boolean",
"description": "Use N-API for version-independent builds",
"default": true
},
"prebuildConfig": {
"type": "boolean",
"description": "Generate prebuild configuration",
"default": false
}
},
"required": ["projectPath"]
}{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"configuration": {
"type": "object",
"properties": {
"electronRebuild": { "type": "object" },
"nodeGyp": { "type": "object" },
"packageJson": { "type": "object" }
}
},
"scripts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"command": { "type": "string" }
}
}
},
"warnings": { "type": "array", "items": { "type": "string" } }
},
"required": ["success"]
}// package.json
{
"scripts": {
"postinstall": "electron-rebuild",
"rebuild": "electron-rebuild -f -w native-module-name"
},
"devDependencies": {
"@electron/rebuild": "^3.6.0"
}
}# Set Electron headers for node-gyp
export npm_config_target=28.0.0
export npm_config_arch=x64
export npm_config_target_arch=x64
export npm_config_disturl=https://electronjs.org/headers
export npm_config_runtime=electron
export npm_config_build_from_source=true
npm install native-module# electron-builder.yml
npmRebuild: true
buildDependenciesFromSource: true
nodeGypRebuild: false
asarUnpack:
- "**/*.node"
- "**/node_modules/native-module/**"N-API provides ABI stability across Node.js versions:
// binding.gyp for N-API module
{
"targets": [
{
"target_name": "native_module",
"sources": ["src/native_module.cc"],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")"
],
"dependencies": [
"<!(node -p \"require('node-addon-api').gyp\")"
],
"defines": ["NAPI_VERSION=8", "NAPI_DISABLE_CPP_EXCEPTIONS"]
}
]
}For distributing prebuilt binaries:
// package.json
{
"scripts": {
"prebuild": "prebuild -t 28.0.0 -r electron -a x64 -a arm64",
"prebuild-upload": "prebuild --upload-all $GITHUB_TOKEN"
},
"devDependencies": {
"prebuild": "^12.1.0",
"prebuild-install": "^7.1.1"
}
}# Using electron-rebuild with wine
npx @electron/rebuild --platform=win32 --arch=x64
# Or with prebuild
prebuild -t 28.0.0 -r electron --platform=win32 --arch=x64# Requires Xcode and arm64 toolchain
npx @electron/rebuild --arch=arm64# Using Docker
docker run -v $(pwd):/project electron-builder-linux \
npx @electron/rebuild --platform=linux --arch=x64| Module | Use Case | N-API Support |
|---|---|---|
| better-sqlite3 | SQLite database | Yes |
| sharp | Image processing | Yes |
| node-pty | Terminal emulation | Yes |
| serialport | Serial communication | Yes |
| robotjs | Desktop automation | Limited |
| node-hid | USB HID devices | Yes |
Error: The module was compiled against a different Node.js versionSolution: Rebuild with correct Electron version:
npx @electron/rebuild -v 28.0.0Windows: Install Visual Studio Build Tools
npm install -g windows-build-toolsmacOS: Install Xcode Command Line Tools
xcode-select --installLinux: Install build-essential
sudo apt-get install build-essential# Specify Python version for node-gyp
npm config set python /usr/bin/python3electron-builder-config - Package native modules correctlyelectron-main-preload-generator - Secure native module usagecross-platform-test-matrix - Test native modules across platformselectron-architect - Architecture for native modulesdesktop-ci-architect - CI/CD for native module builds~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.