2

I'm creating an app using electron and nodejs, when I try to build it with electron-builder using following command:

electron-builder --mac --linux --win --x64

it builds native modules only for my current os. Is there a way to build native modules for all operating systems?

StackedQ
  • 3,999
  • 1
  • 27
  • 41

2 Answers2

6

you can't. https://www.electron.build/multi-platform-build

If your app has native dependency, 
it can be compiled only on the target platform unless prebuild is not used.

prebuild is a solution, but most node modules don't provide prebuilt binaries.
macOS Code Signing works only on macOS. Cannot be fixed.
OJ Kwon
  • 4,385
  • 1
  • 20
  • 24
0

You can look at https://www.npmjs.com/package/@centrid/native-modules-prebuilds-creator (homepage: https://github.com/centridsol/native-module-prebuilds-creator) . It allows you to create multiple prebuilds for your native node dependencies and then use those prebuilds whilst building your electron app