GithubHelp home page GithubHelp logo

Comments (6)

Pixelherz23 avatar Pixelherz23 commented on May 29, 2024 1

Please provide the code that throws the error

from lowdb.

typicode avatar typicode commented on May 29, 2024 1

v7 should fix it, let me know if it's not the case

from lowdb.

shaonhuang avatar shaonhuang commented on May 29, 2024

Windows:
Error: EPERM: operation not permitted, rename 'C:\Users\shaonhuang\AppData\Roaming\v2rayx\lowdb\.db.json.tmp' -> 'C:\Users\shaonhuang\AppData\Roaming\v2rayx\lowdb\db.json'

my code runs like the below

lowdb file

const userData = app.getPath('userData');
const dbPath = join(userData, 'lowdb', 'db.json');
const parentDir = join(userData, 'lowdb');
if (!existsSync(parentDir)) {
  mkdirSync(parentDir);
}
const adapter = new JSONFile<Data>(dbPath);
const db = new LowWithLodash(adapter, defaultData);
export default db;

Linux shows it too.
ENOENT: no such file or directory, rename '/home/xxxx/snap/v2rayx/307/.config/v2rayx/lowdb/.db.json.tmp' -> '/home/xxxx/snap/v2rayx/307/.config/v2rayx/lowdb/db.json'

await db.read();
db.data = db.chain.set('appVersion', app.getVersion()).value();
await db.write();

Getting the same error. It has lasted for a long time. and still not fixing.

from lowdb.

typicode avatar typicode commented on May 29, 2024

It's happening here. Typical atomic write AFAIK.
https://github.com/typicode/steno/blob/main/src/index.ts#L47-L48

I don't know why it's failing, sorry about that. But the code is tested with 1000 concurrent writes here:
https://github.com/typicode/steno/blob/main/src/test.ts

Feel free to create a failing test in a PR (and optionally a fix) as I really don't know why it's occuring 🤔

from lowdb.

shaonhuang avatar shaonhuang commented on May 29, 2024

v7 should fix it, let me know if it's not the case

Error: ENOENT: no such file or directory, open 'C:\Users\xxxx\AppData\Roaming\v2rayx\lowdb.dbv4.json.tmp'

issue still exists in the new version.

from lowdb.

typicode avatar typicode commented on May 29, 2024

Hmm, could you try disabling your antivirus?
Is it an old hard drive or big db.json or are you doing a lot of writes?

Can you go to node_modules/steno/lib/index.js and change this value from 100 to 1000? This will try to rename tmp file 10 times with an interval of 1000ms instead of 100ms. Giving more time maybe for the system to scan this file.
https://github.com/typicode/steno/blob/main/src/index.ts#L73

from lowdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.