3

I have a trouble with a sqlite3 module for electron. I had been looking about this problem before ask, but any answer has solved my problem.

I have installed this module in electron in a some computers, in first place the module don't works and appears the next error:

"Cannot find module .../node_modules/sqlite3/lib/binding/electron-v1.4-linux-x64/node_sqlite3.node"

I have seen in another stackoverflow thread that I should rename the folder node-v48-linux-x64 to electron-v1.4-linux-x64, this problem in a few computers have been solved. But in other computers I have another problem:

Uncaught Error: Module version mismatch. Expected 50, got 48.

My node version is the 6.6 and my npm version is 3.10.3.

Matthew Simoneau
  • 6,199
  • 6
  • 35
  • 46

2 Answers2

0

You have to give a try for electron-rebuild package and rebuild the sqlite package for using with electron against electron headers (electron uses patched version of nodejs)

Look at instruction as well.

Also take a look for this answer How to use sqlite3 module with electron?

Community
  • 1
  • 1
uladzimir
  • 5,639
  • 6
  • 31
  • 50
0

Rather than renaming the folder, which lead to an error similar to yours, I had success by specifying the version of Electron by adding -v to my build command:

./node_modules/.bin/electron-rebuild -v 1.4.13

This created the electron-v1.4-win32-x64 it was looking for, instead of electron-v1.6-win32-x64, and the module versions lined up correctly.

Matthew Simoneau
  • 6,199
  • 6
  • 35
  • 46