@electron/rebuild

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

Tool
npm
v4.2.0
1,123stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
85/100Excellent
Development Activity88
Maintenance80
Community84
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture80
Code Quality85
Innovation78
Learning Curve88

@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 17 apps in this directory

TypeScript
94%
MIT

Actual

Invoicing Finance

28,593

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
77
Dependency
Built with
TypeScript94%
Updated today
TypeScript
98%
MIT

Cate

AI Code Assistants

2,122

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
79
Repo Health
71
Technical
72
Dependency
Built with
TypeScript98%
Updated yesterday
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

51,521

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

View details
89
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
TypeScript
99%
Apache 2.0

Colanode

Knowledge Management · Team Chat · Collaboration

5,097

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
47
Repo Health
73
Technical
70
Dependency
Built with
TypeScript99%
Updated 5 months ago
TypeScript
84%
Apache 2.0

Continue

Developer Tools · AI Development · AI Code Assistants

35,808

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

View details
81
Repo Health
88
Technical
62
Dependency
Built with
TypeScript84%
Updated yesterday
TypeScript
58%
AGPL 3.0

Frappe Books

Invoicing Finance

4,936

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

View details
90
Repo Health
77
Technical
73
Dependency
Built with
TypeScript58%
Vue39%
Updated yesterday
TypeScript
76%
Other

Joplin

Note Taking

56,257

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
61
Dependency
Built with
TypeScript76%
JavaScript14%
Updated yesterday
TypeScript
77%
AGPL 3.0

massCode

Developer Tools · Productivity · Code Editors

6,977

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
62
Dependency
Built with
TypeScript77%
Vue22%
Updated yesterday
TypeScript
92%
Other

n8n

Automation · No Code Platforms

203,555

Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.

View details
95
Repo Health
87
Technical
66
Dependency
Built with
TypeScript92%
Updated today

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

Search