I\'m trying to use sequelize and sqlite with electron in a desktop application but get the following error when running the app via npm start
(which runs node
I know you have sqlite3
installed and working alone but the problem arise when you try to use sqlite3
with electron
together. It's because of ABI version mismatch.
When you put a
console.log(err);
in
line 21,
just before throw new Error('Please install sqlite3 package manually');
you will see an error like following:
{ [Error: Cannot find module '/node_modules/sqlite3/lib/binding/node-v44-linux-x64/node_sqlite3.node'] code: 'MODULE_NOT_FOUND' }
However when you check /node_modules/sqlite3/lib/binding/
folder there will be no node-v44-linux-x64
folder but something like node-v11-linux-x64
folder. (Simply renaming the folder won't work.)
This mismatch occurs because electron uses io.js v3.1.0
internally as it states here and ABI versions of it and your version of nodejs don't match.
Note that node-vXX
is decided via your node's ABI version. Check this url for further info: https://github.com/mapbox/node-pre-gyp/issues/167
Solution
The easy way stated here https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md#the-easy-way doesn't work as-is with sqlite
but you can follow these steps to make it work:
After installing electron-rebuild
via following command
npm install --save-dev electron-rebuild
go to
and find your node version, then change node_abi
value to 44
. Like following:
"0.12.7": {
"node_abi": 44,
"v8": "3.28"
},
then give ./node_modules/.bin/electron-rebuild
command and wait a bit. Then it works.