Open mark89769 opened 8 years ago
What's the file path expected when is compiled into an executable file. For instance, in macOS my project works fine when running it with npm start
But, after packaging it with electron-package and attempting to execute it, the error is appears stating that Uncaught Error: ENOENT: no such file or directory, open filename - datastore.js:77
Where is supposed to be located the db file after application is packaged? Have been tested the NeDB on compiled apps? If so, what's the path to use?
I have the same issue, someone have any idea to resolve it.
The problem is because the data must located in the user data on windows for example, this mode the app can access to database.
to use: var Datastore = require('nedb'); var userData = app.getPath('userData'); db.banks = new Datastore(userData+'/db/banks.db');
@oscarato thx a lot it's working, and I'm learning in same time ;)
Hi @Oscarato i had the same issues and i have tried it this way
var electron = require('electron');
const app = electron.remote.app;
var userData = app.getAppPath('userData');
db = new Datastore({ filename: userData+'/db/persons.db', autoload: true });
but i am getting error in linux and MAC. its only on build.
Any Idea Please
Hi @Oscarato This is my mistake. Its working fine now. I have used app.getAppPath() instead of app.getPath('userData')
var electron = require('electron');
const app = electron.remote.app;
var userData = app.getAppPath('userData'); <-------- Here i made issues this is app.getPath('userData')
db = new Datastore({ filename: userData+'/db/persons.db', autoload: true });
Thank You :)
I can't get nedb to load/creata a database file on a specific location with NWjs. Is this possible? For example I would like to use a single database stored on a network folder for multiple instances of NWjs.