question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support modules with bundled prebuilds for electron

See original GitHub issue

All new native modules I’ve been writing, use a new technique where I bundle all prebuilds inside the npm tarball and the pick the right one at runtime. A huge benefit of this is that using these modules with electron just works, no compilation needed.

However when people use electron-rebuild, it forces the prebuilded modules to rebuild by running node-gyp rebuild instead of running the install script if present in package.json. Ironically this breaks some of my modules that support electron out of the box cause it tries to recompile them without running a preinstall script specificed by the install script.

Anyway to fix this?

As an example try my sodium-native module. It is a native module that works across node/electron without needing any recompilation that breaks when electron-rebuild tries to recompile it, cause it isn’t running the install script instead node-gyp like npm does.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mafintoshcommented, Apr 13, 2017

@MarshallOfSound yea you can look for ./prebuilds/{platform}-{arch}/electron-{electron-abi}.node. fx on macOS (darwin) it’ll look like this, prebuilds/darwin-x64/electron-50.node. If that file is present you should just skip the recompilation. That’d be super awesome!!

1reaction
mafintoshcommented, Apr 9, 2017

FYI, this works perfectly fine, npm rebuild --runtime=electron --target=$(electron --version) --disturl=https://atom.io/download/atom-shell --abi=$(electron --abi)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support modules with bundled prebuilds for electron #162
All new native modules I've been writing, use a new technique where I bundle all prebuilds inside the npm tarball and the pick...
Read more >
Native Node Modules | Electron
prebuild provides a way to publish native Node modules with prebuilt binaries for multiple versions of Node and Electron. If the prebuild -powered...
Read more >
bundling precompiled binary into electron app - Stack Overflow
js modules but they are all wrappers or native binding to the system wide installed libraries. I wonder if it's possible to bundle...
Read more >
electron-prebuilt - npm
This module helps you easily install the electron command for use on ... Electron is a JavaScript runtime that bundles Node.js and Chromium....
Read more >
Options | electron-packager
Functions to be called after the prebuilt Electron binary has been extracted to a ... See the module for option descriptions, proxy support,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found