fs.existsSync is not a function
I get this error when I try to create a table: fs.existsSync is not a function
What do I do wrong?
const db = require('electron-db') db.createTable('tasks', (succ, msg) => { // succ - boolean, tells if the call is successful console.log("Success: " + succ) console.log("Message: " + msg) })
I found out it was because I was running it through the front-end, but is there any way I can register it and use it through my front-end? I'm running VueJS in my Electron app.
I have the same problem
if your using vue.js
you have 2 options
option 1: change require to window.require
option 2:
create a file in the root named vue.config.js and put this inside it
module.exports = { pluginOptions: { electronBuilder: { nodeIntegration: true } } };
the reason you get that is because newer electron has node integration at the core disabled, setting it on the browser window is not enough because that only applies if its enabled at the core (which it is not by default) so you either have to use window.require, or the vue.config.js to enable it at the core
otherwise I have no idea for any other frameworks
Thank you SolarIceMedia for that info!