I am getting an error while connecting to sqlite3
database.
This is my code
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('testdb');
db.serialize(function(){
dbb.run("create table user (id int, db text)");
var stmt = db.prepare("insert into user values(?,?)");
for(var i=0; i<10; i++){
var d = new Date();
var n = d.toLocateTimeString();
stmt.run(i,n);
}
stmt.finalize();
db.each("select id, dt from user",function(err,row){
console.log("user id:"+row.id,row.dt);
});
});
db.close();
Error is:
Uncaught Error: Cannot find module 'path_to_project\node_modules\sqlite3\lib\binding\electron-v1.4-win32-ia32\node_sqlite3.node'
When i check in this folder node_modules\sqlite3\lib\binding
, it's having a folder and a file like node-v48-win32-ia32\node_sqlite3.node
instead of electron-v1.4-win32-ia32\node_sqlite3.node
.
Somebody suggested me to change the folder name node-v48-win32-ia32
to electron-v1.4-win32-ia32
. Then it will work. But it returns another error
ELECTRON_ASAR.js:173 Uncaught Error: The system cannot find message text for message number 0x%1 in the message file for %2. \?\path_to_project\node_modules\sqlite3\lib\binding\electron-v1.4-win32-ia32\node_sqlite3.node
Can anyone suggest a solution for this? I searched a lot, but no solution found for this one.