node-adodb
node-adodb copied to clipboard
Can't call query() in Electron: childProcess.spawn is not a function
If i run my code in node it works just fine, but i can't call the query() function if it runs in electron. Is this a limitation of electron or am i missing something here?
I changed this line in engine.js because in Vue the env variables where not set correctly:
const sysroot = process.env['systemroot'] || process.env['windir'] || "C:\\WINDOWS";
I import and open the connection like this:
const ADODB = require("node-adodb")
const connection = ADODB.open("Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\\Users\\XXXX\\YYYY\\ZZZZ.accdb;Uid=Admin;Pwd=;");
but when i call
console.log(connection.query("SELECT * FROM MSysObjects WHERE Type=1 AND Flags=0"));
it spits out the following error:
log.js?1afd:24 [HMR] Waiting for update signal from WDS...
Home.vue?76f2:16 Promise
spawn.js?d1a4:87 Uncaught (in promise) TypeError: childProcess.spawn is not a function
at eval (webpack-internal:///./node_modules/node-adodb/lib/spawn.js:87)
at new Promise (<anonymous>)
at spawn (webpack-internal:///./node_modules/node-adodb/lib/spawn.js:74)
at Proxy.exec (webpack-internal:///./node_modules/node-adodb/lib/proxy.js:40)
at ADODB.query (webpack-internal:///./node_modules/node-adodb/index.js:64)
at VueComponent.created (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/Home.vue?vue&type=script&lang=js&:17)
at invokeWithErrorHandling (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1862)
at callHook (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:4229)
at VueComponent.Vue._init (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5012)
at new VueComponent (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5158)
I just found out that this only happens with
console.log(connection.query("SELECT * FROM MSysObjects WHERE Type=1 AND Flags=0"));
this query works fine:
console.log(connection.query("SELECT * FROM Resistors"));