Rebuild native Node.js modules against the currently installed Electron version for compatibility.
@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.
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.
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.
Package to rebuild native Node.js modules against the currently installed Electron version
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.'
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.
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.
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.
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.
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.
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.
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.
A fast, local first, reactive Database for JavaScript Applications https://rxdb.info/
🌐 Human-friendly and powerful HTTP request library for Node.js
A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
The JavaScript Database, for Node.js, nw.js, electron and the browser
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.