Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Electron
  3. electron-rebuild

electron-rebuild

MITTypeScriptv4.0.4

Rebuild native Node.js modules against the currently installed Electron version for compatibility.

GitHubGitHub
1.1k stars179 forks0 contributors

What is electron-rebuild?

@electron/rebuild is a tool that recompiles native Node.js modules to be compatible with the specific Node.js version used by an Electron application. It solves the problem where native modules built for the system's Node.js runtime fail in Electron due to version mismatches, enabling developers to use these modules in their Electron apps seamlessly.

Target Audience

Electron developers who need to use native Node.js modules (e.g., those with C++ bindings) in their desktop applications, particularly those integrating modules like sqlite3, bcrypt, or sharp.

Value Proposition

Developers choose @electron/rebuild because it automates the compatibility process between native modules and Electron's custom Node.js runtime, eliminating manual rebuilds. It integrates directly with popular Electron tooling like Electron Forge and Electron Packager, and supports both CLI usage for one-off tasks and a JavaScript API for build pipeline integration.

Overview

Package to rebuild native Node.js modules against the currently installed Electron version

Use Cases

Best For

  • Ensuring native Node.js modules work correctly after updating Electron versions in an existing project.
  • Integrating native modules into Electron apps when the system's Node.js version differs from Electron's Node.js version.
  • Automating native module rebuilds as part of a CI/CD pipeline for Electron applications.
  • Using Electron Forge or Electron Packager to package apps that depend on native modules.
  • Rebuilding specific native modules selectively (e.g., only production dependencies) to optimize build times.
  • Handling cross-platform builds where native modules need to be compiled for different operating systems or architectures.

Not Ideal For

  • Projects that exclusively use JavaScript or TypeScript modules without any native Node.js dependencies.
  • Apps relying entirely on prebuilt binaries for all native modules, where no compilation from source is ever necessary.
  • Teams with stringent CI/CD time limits who cannot tolerate the added build overhead of recompiling modules on every change.
  • Developers building for alternative desktop frameworks like NW.js or Tauri that have different native module handling mechanisms.

Pros & Cons

Pros

Automatic Electron Compatibility

Rebuilds native modules against the exact Node.js version used by Electron, directly addressing version mismatch issues as stated in the README: 'rebuilds native Node.js modules against the version of Node.js that your Electron project is using.'

Seamless Tool Integration

Works out-of-the-box with Electron Forge and integrates via hooks with Electron Packager, plus supports prebuild/prebuild-install for downloading binaries, making it a versatile part of the Electron ecosystem.

Selective Rebuild Options

Allows targeting specific modules or dependency types (prod, dev, optional) using CLI flags like --which-module and --types, which can optimize build times by avoiding unnecessary compilations.

Dual CLI and API Interface

Provides a command-line interface for manual rebuilds and a JavaScript API for programmatic integration into custom build pipelines, offering flexibility for different development workflows.

Cons

node-gyp Dependency Headaches

Relies on node-gyp for building from source, which can be complex to set up, especially on Windows where errors like missing Visual C++ components are common, as noted in the README troubleshooting section.

Build Time and Performance Overhead

Rebuilding native modules from source can significantly slow down development and deployment cycles, particularly for large projects or when modules require frequent updates, adding operational friction.

Limited Scope to Native Modules

Only beneficial for projects with native Node.js dependencies; it provides no value for apps using purely JavaScript modules, making it an unnecessary tool in those contexts.

Integration Complexity for Custom Pipelines

While it integrates with popular tools, using the JavaScript API in custom build setups requires precise configuration (e.g., buildPath, electronVersion), which can lead to errors if not handled carefully.

Frequently Asked Questions

Quick Stats

Stars1,117
Forks179
Contributors0
Open Issues104
Last commit7 days ago
CreatedSince 2015

Tags

#native-modules#npm-package#cli-tool#javascript#compatibility#node-js#node-gyp#build-tool#electron

Built With

J
JavaScript
N
Node.js

Included in

Electron27.1k
Auto-fetched 7 hours ago

Related Projects

rxdbrxdb

A fast, local first, reactive Database for JavaScript Applications https://rxdb.info/

Stars23,163
Forks1,164
Last commit10 hours ago
gotgot

🌐 Human-friendly and powerful HTTP request library for Node.js

Stars14,898
Forks983
Last commit8 days ago
electron-builderelectron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box

Stars14,537
Forks1,844
Last commit14 hours ago
NeDBNeDB

The JavaScript Database, for Node.js, nw.js, electron and the browser

Stars13,555
Forks1,020
Last commit11 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub