I have an issue with my on going app : I'm creating a desktop app using Electron-Forge, with React on Frontend and NodeJS on Backend. I need to use an Access DB as my DB, so I'm using node-adodb.
Here's what my db.js looks like :
const path = require("path");
const { app } = require("electron");
//'use strict';
const ADODB = require("node-adodb");
const connection = ADODB.open(
`Provider=Microsoft.ACE.Oledb.12.0;Data Source=${
app.isPackaged
? path.join(`${__dirname}/../../../../../BDD/testBDD.accdb`)
: path.join(`${__dirname}/../../../client/out/BDD/testBDD.accdb`)
};`,
false
);
module.exports = connection;
When I try to access to my db, with a simple query, it works perfectly fine on dev mode (npm start), but not when the app is built (npm run package), I have the following error :
Spawn C:\Windows\SysWOW64\cscript.exe error
I spend the last days looking for a solution online, but nothing helped me.. May be someone knows a way here ?
By advance sorry, I'm a begginer in dev, you might need other informations to help, if so, you can consult my github repository for more details : https://github.com/Pavol-69/oxalis
Thank you !
So.. I finally found the answer right after asking for help.. u_u'
I'll explain in case other are looking for this information : As explained in this topic - ms access db connection in node.js -, we need to not pack adodb.js in app.asar
To do that, on Electron Forge, you have to go in forge.config.js and add adodb.js as an exception to the app.asar in packagerConfig :
This way, adodb.js will appear in your ressources directory once packaged, out of app.asar :
When it's configured, you need to say where is this adodb.js when it's packaged in you db.js :
And now, if you package this way, tadaaa ! Build is working with Access DB !