@electron/rebuild

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

Tool
npm
v4.2.1
1,123 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
84 /100 Excellent
Development Activity 88
Maintenance 76
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
92%
Other

n8n

Automation · No Code Platforms

206,853

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
62
Dependency
Built with
TypeScript 92%
Updated 2 weeks ago
TypeScript
71%
Apache 2.0

open-design

Design Tools

100,256

Local-first, open-source Claude Design alternative that turns your existing coding agent CLI into a full agentic design studio — with 259+ skills, 142+ design systems, and sandboxed artifact delivery across web, desktop, and mobile surfaces.

View details
85
Repo Health
86
Technical
72
Dependency
Built with
TypeScript 71%
HTML 22%
Updated 1 weeks ago
TypeScript
82%
MIT

OpenScreen

Design Tools · Note Taking · Productivity

39,923

Free, open-source screen recorder with zooms, annotations, and system audio capture

View details
51
Repo Health
85
Technical
78
Dependency
Built with
TypeScript 82%
Updated 4 months ago
TypeScript
95%
MIT

Orca

AI Agents · AI Code Assistants

88,731

An open-source Agent Development Environment that orchestrates fleets of parallel AI coding agents — Claude Code, Codex, Gemini and more — each running in its own isolated git worktree.

View details
84
Repo Health
85
Technical
80
Dependency
Built with
TypeScript 95%
Updated 1 weeks ago
TypeScript
82%
AGPL 3.0

Recordly

Design Tools · Developer Tools · Productivity

32,972

Free, open-source screen recorder and editor for macOS, Windows, and Linux that auto-adds zooms, cursor polish, webcam overlays, and styled frames to your screen captures without any motion-design skills.

View details
84
Repo Health
82
Technical
70
Dependency
Built with
TypeScript 82%
Updated 1 weeks ago
TypeScript
97%
AGPL 3.0

Responsively App

Design Tools · Developer Tools

25,234

Preview and interact with your responsive web design across every device size simultaneously — no more manual resizing.

View details
82
Repo Health
71
Technical
66
Dependency
Built with
TypeScript 97%
Updated 2 weeks ago
TypeScript
83%
AGPL 3.0

Standard Notes

Note Taking

6,648

End-to-end encrypted notes and files — private by design, built to last, and fully self-hostable.

View details
89
Repo Health
83
Technical
68
Dependency
Built with
TypeScript 83%
JavaScript 14%
Updated 2 weeks ago
Python
68%
Apache 2.0

SurfSense

AI Assistants · Search

16,342

The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.

View details
88
Repo Health
71
Technical
66
Dependency
Built with
Python 68%
TypeScript 29%
Updated 2 weeks ago
TypeScript
97%
Other

Termix

Devops

15,368

Manage all your servers — SSH terminals, remote desktops, file transfers, and Docker containers — from a single self-hosted browser interface.

View details
84
Repo Health
67
Technical
74
Dependency
Built with
TypeScript 97%
Updated 1 weeks 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