question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

var location= path.dirname(process.execPath)+"\\app\\db\\database.json";
var db = new Nedb({ filename: test, autoload: true });

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
fpassacommented, Jan 31, 2017

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?

3reactions
javeedrahmancommented, May 22, 2017

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 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the naming standard for path components?
Paths include the root, the filename, or both. That is, paths can be formed by adding either the root, filename, or both, to...
Read more >
File path formats on Windows systems | Microsoft Learn
In this article, learn about file path formats on Windows systems, such as traditional DOS paths, DOS device paths, and universal naming ...
Read more >
filename and pathname of a file - Unix & Linux Stack Exchange
A file name is a name a particular inode is called inside a particular directory. A path is some instructions for how to...
Read more >
File Names and File Paths
File Names and File Paths. Specifying which file to open involves not only the file name but also the extension and the path....
Read more >
std::filesystem::path::filename - cppreference.com
std::filesystem::path::filename. From cppreference.com. < cpp‎ | filesystem‎ | path · C++ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found