So here is what i did, i installed electron and sqlite3 inside my project directory
npm install electron --save-dev
npm install sqlite3
but when i try to run this using npm start it gives me error
var sqlite3 = require('sqlite3').verbose();
this line is inside my main.js where i initialize electron things etc. and it works fine without this line. here's the error i get.
Uncaught Exception:
Error: Cannot find module '/home/touseef/Desktop/Projects/pos/node_modules/sqlite3/lib/binding/electron-v6.0-linux-x64/node_sqlite3.node'
Require stack:
- /home/touseef/Desktop/Projects/pos/node_modules/sqlite3/lib/sqlite3.js
- /home/touseef/Desktop/Projects/pos/main.js
- /home/touseef/Desktop/Projects/pos/node_modules/electron/dist/resources/default_app.asar/main.js
-
at Module._resolveFilename (internal/modules/cjs/loader.js:627:15)
at Function.Module._resolveFilename (/home/touseef/Desktop/Projects/pos/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:41:16)
at Function.Module._load (internal/modules/cjs/loader.js:531:27)
at Module.require (internal/modules/cjs/loader.js:685:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/home/touseef/Desktop/Projects/pos/node_modules/sqlite3/lib/sqlite3.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:786:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
at Module.load (internal/modules/cjs/loader.js:645:32)
at Function.Module._load (internal/modules/cjs/loader.js:560:12)
My node version is 10.16.3 and i'm running Ubuntu.
Just had this issue too. I had to rebuild sqlite3.
Installed electron-rebuild, and added "scripts": { "rebuild": "electron-rebuild -f -w sqlite3" },
to my package.json. Then executed npm run rebuild, and let it rebuild. Got rid of this error for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With