1

My goal is to create a distribution for Mac AND an other for Windows. I want to create these two distributions from my Mac. For the moment, my distribution for Mac works well.

But I still have problem with sqlite3 module for the Windows distribution.

The only native module that my app uses is sqlite3.

I really don't know what to do to finally get my app works correctly on Windows. I don't want to compile my code on a Windows machine. I want to compile my code on my Mac only.

My config is :

  • node v12.2.0
  • npm v6.9.0
  • electron v5.0.1
  • sqlite3 v4.0.8
  • MacOS Mojave v10.14.0

Trying to compile sqlite3 module for Windows with :

node-pre-gyp install --directory=./node_modules/sqlite3 --target_platform=win32 --target_arch=x64 --target=12.2.0

node-pre-gyp returns these messages :

node-pre-gyp WARN Using request for node-pre-gyp https download
Warning: node-pre-gyp could not find exact match for 12.2.0
Warning: but node-pre-gyp successfully choose 12.0.0 as ABI compatible target
Warning: node-pre-gyp could not find exact match for 12.2.0
Warning: but node-pre-gyp successfully choose 12.0.0 as ABI compatible target

[sqlite3] Success: "/Users/Flooder/Programmes/electron/c4/node_modules/sqlite3/lib/binding/node-v72-win32-x64/node_sqlite3.node" is installed via remote

I get a new directory : ./node_modules/sqlite3/lib/binding/node-v72-win32-x64

I rename this new directory for : ./node_modules/sqlite3/lib/binding/electron-v5.0-win32-x64

When I try my new distribution on Windows machine, I get this error :

Uncaught Exception: Error: The module D:\c4\resources\app\node_modules\sqlite3\lib\binding\electron-v5.0-win32-x64\node_sqlite3.node was compiled against a different Node.js version using NODE_MODULE 72. This version of Node.js requires NODE_MODULE_VERSION 70. Please try re-compiling or re-installing the module (for instance, using 'npm rebuild' or 'npm install').

...

I'm stuck with this problem since many weeks...

Is it really possible to compile sqlite3 module for Windows from a Mac?

Is node-pre-gyp the right solution for this? How?

2
  • I've run into a similar issue with node-canvas – ("NODE_MODULE_VERSION " mismatch, etc.). Spent a few days juggling versions of everything but finally gave up.
    – spring
    May 14, 2019 at 16:32
  • I will give up soon too my friend!
    – La Page PT
    May 14, 2019 at 21:36

1 Answer 1

2

Finally, here is my solution :

  • Installed Parallel Desktop on my mac;
  • Installed Windows 10 in this virtual machine;
  • Installed node, npm, python, electron, electron-rebuild, sqlite, etc. on the virtual Windows machine;
  • Recompiled sqlite3 with "electron-rebuild -f -w sqlite3" on the virtual machine
  • Copied the new ./node_modules/sqlite3/lib/binding/electron-v5.0-win32-x64 from Windows to Mac
  • On the mac, recompiled my electron app for PC with electron-packager

And now, the new compiled version for Windows works on a Win machine!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.