-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: ENOENT: no such file or directory, rename 'path/file.js~' -> 'path/file.js' (while using nodemon) #462
Comments
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 But, after packaging it with electron-package and attempting to execute it, the error appears by 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 this been tested (the NeDB) on compiled apps? If so, what's the path to use? |
i have the same problem, when the error is happen, the content of the data file is clear, how to deal it? |
up, i have the same problem when electron app is in an ASAR package |
I met the same problem, but i found that error appears when creating multiple instances of datastore with same filename. You have to instantialize datastore only once and keep reference across whole app. May be developers should provide singleton/factory (for example |
when i use |
I have the same issue in tests... |
We don’t need a new API to have singletons, just abstract it with a local module of your own, e.g.
const Datastore = require('nedb');
const db = {
tableName: new Datastore({ filename: '...' })
};
module.exports = db; |
Check if you are trying to open two or more connections at once. In my case I'm opening two connections and get the error. |
How can we open two or more connections at once? I have this code that give me same error:
|
@xeroxstar your code tries to open multiple databases (files). What if you have just one file, let's say
This code wasn't tested. |
thank for reply, yes you right, i guess i will do it if there is no solution to solve what i am trying to achieve... |
I am using next.js api routes, and in development mode there a lot of HMR reloads, so extracting db to a module does not help, nothing helps so far. |
Now, I don't know if it's nodemon or nedb's fault, but sometimes I have to restart nodemon a couple times because this error comes up... Not a huge deal, but still annoying. Please note that I'm also using the --ignore flag so the file.js~ automatic refresh doesn't infinitely loop with nodemon's own automatic refresh, idk if this has something to do with my issue.
The text was updated successfully, but these errors were encountered: