@electron/rebuild

Rebuilds native Node.js modules against your installed Electron version so npm install just works.

Tool
npm
v4.2.0
1,123 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
83 /100 Excellent
Development Activity 88
Maintenance 72
Community 84
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 80
Code Quality 85
Innovation 78
Learning Curve 88

@electron/rebuild is the official Electron tooling package that recompiles native Node.js addons (modules with a binding.gyp) against the exact Node ABI that your installed Electron version uses, rather than the system Node.js you ran npm install with. It walks a project’s node_modules tree, detects any native module that needs a rebuild, and drives node-gyp, prebuild-install, node-pre-gyp, or prebuildify, whichever the module actually uses, downloading Electron’s header files as needed.

It ships both as the electron-rebuild CLI binary you run after every npm install and as a programmatic rebuild() API that tools like Electron Forge and Electron Packager call automatically during packaging, with options for parallel or sequential rebuilds, targeting a specific architecture, using Electron’s own clang, and an experimental rebuild cache to skip redundant work on unchanged modules.

What You Get

  • electron-rebuild CLI - A single binary you run after npm install to rebuild every native module in node_modules against your target Electron version.
  • Programmatic rebuild() API - Import rebuild() directly to drive rebuilds from your own build scripts, or via the afterCopy hook in Electron Packager.
  • Multi-strategy module detection - Automatically picks the right rebuild path per module: node-gyp compilation, prebuild-install, node-pre-gyp, or prebuildify.
  • Architecture and ABI overrides - Target a different --arch or override the ABI version explicitly for nightly Electron builds.
  • Experimental rebuild cache - Hash-based caching (useCache) skips modules that haven’t changed since the last rebuild.

Common Use Cases

  • Electron app scaffolding - A developer adds a native module like better-sqlite3 to an Electron app and runs electron-rebuild so the module loads under Electron instead of throwing an ABI mismatch error.
  • Packaging pipeline integration - Electron Forge and Electron Packager call @electron/rebuild’s rebuild() automatically in their afterCopy hook so packaged apps ship correctly compiled native binaries.
  • CI matrix builds - A CI pipeline targeting Windows, macOS, and Linux runs electron-rebuild —arch <target> per platform to produce architecture-specific native binaries for multi-platform releases.
  • Monorepo/workspace builds - Projects using Yarn or npm workspaces point —module-dir/projectRootPath at the workspace root so rebuild resolves the shared node_modules correctly.

Under The Hood

Architecture A Rebuilder class orchestrates the whole process: a ModuleWalker walks the project’s node_modules tree (respecting prod/dev/optional dependency types and workspace roots) to find candidate paths containing a binding.gyp, and a ModuleRebuilder wraps the per-module rebuild logic, delegating to one of four strategy classes under src/module-type/ (node-gyp, prebuildify, prebuild-install, node-pre-gyp) depending on how that specific module was built. The public rebuild() function wraps this in an EventEmitter-based lifecycle (start, modules-found, module-found, module-done, module-skip) so callers like Electron Forge and Packager can hook into progress without polling.

Tech Stack Written in TypeScript as a native ESM package ("type": "module"), compiled with tsc, and distributed as a single lib/main.js entry plus an electron-rebuild CLI binary. Core runtime dependencies are narrow and purpose-built: node-gyp for compilation, node-abi/node-api-version for ABI resolution, @malept/cross-spawn-promise for subprocess orchestration, and read-binary-file-arch for architecture detection. Tooling uses Yarn 4 (Berry) with immutable installs, oxlint/oxfmt for linting and formatting, vitest with @vitest/coverage-v8 for tests, and typedoc for generated API docs, requiring Node >=22.12.

Code Quality The test/ directory mirrors src/, with dedicated spec files per module-type strategy (node-gyp, node-pre-gyp, prebuild-install, prebuildify) plus fixture/ and helpers/ support directories, exercising real rebuild scenarios rather than only mocks. CI runs the full suite across macOS, Ubuntu, and Windows via GitHub Actions on every PR and on a weekly schedule, lints with oxlint/oxfmt, and uploads coverage to Codecov, with husky and lint-staged enforcing checks pre-commit. Types are strict throughout, with detailed TSDoc comments on every public option.

What Makes It Unique Rather than exposing a sprawling configuration surface, it centers on one rebuild() call with a RebuildOptions interface where nearly every field is optional and documented with sensible defaults (sequential rebuilds on Windows, parallel elsewhere; prod+optional dependency types only). The CLI’s flags map almost one-to-one onto the same options object, so the same mental model carries between scripting the API directly and invoking the binary, and its afterCopy-compatible export lets packaging tools like Electron Forge and Electron Packager wire it in with a single function reference.

Used by 18 apps in this directory

TypeScript
95%
MIT

Actual

Invoicing Finance

29,186

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
73
Dependency
Built with
TypeScript 95%
Updated 5 days ago
Go
59%
Apache 2.0

agent-orchestrator

AI Agents · AI Code Assistants · Developer Tools

12,440

A local desktop workspace that gives every coding task its own agent, Git branch, and worktree, then tracks tasks, pull requests, CI, and reviews for 27 coding agents on one live Kanban board.

View details
86
Repo Health
83
Technical
68
Dependency
Built with
Go 59%
TypeScript 38%
Updated 5 days ago
TypeScript
98%
MIT

Cate

AI Code Assistants

2,162

A desktop IDE built on an infinite canvas — spread code editors, terminals, browsers, docs, and AI agents across freeform space instead of stacking windows and tabs, with layouts restored automatically.

View details
80
Repo Health
71
Technical
72
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

52,202

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
89
Repo Health
84
Technical
70
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
99%
Apache 2.0

Colanode

Collaboration · Knowledge Management · Team Chat

5,152

Local-first, self-hosted workspace that combines real-time chat, Notion-style pages, and structured databases — all synced via CRDTs so you work offline without losing a keystroke.

View details
46
Repo Health
73
Technical
70
Dependency
Built with
TypeScript 99%
Updated 6 months ago
TypeScript
84%
Apache 2.0

Continue

AI Code Assistants · AI Development · Automation

36,049

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
73
Repo Health
88
Technical
62
Dependency
Built with
TypeScript 84%
Updated 6 days ago
TypeScript
58%
AGPL 3.0

Frappe Books

Invoicing Finance

4,990

Offline desktop accounting with double-entry, POS, and custom invoice templates

View details
89
Repo Health
77
Technical
73
Dependency
Built with
TypeScript 58%
Vue 39%
Updated 1 weeks ago
TypeScript
77%
Other

Joplin

Note Taking

56,513

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated 6 days ago
TypeScript
80%
AGPL 3.0

massCode

Code Editors · Developer Tools · Productivity

7,003

A free, local-first developer workspace unifying snippets, notes, HTTP requests, calculations, drawings, and dev tools in one desktop app.

View details
87
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 80%
Vue 19%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers