Comments (6)
Please provide the code that throws the error
from lowdb.
v7 should fix it, let me know if it's not the case
from lowdb.
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.
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.
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.
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)
- vue 安装lowdb后,用import 方式引入的时候产生问题 HOT 1
- does lowdb support dot syntax? HOT 4
- error in clustermode HOT 1
- Open to adding support for deno? HOT 7
- Using lowdb in svelte causes 500 error HOT 1
- Writing data doesn't work when using the Lodash Example HOT 3
- Add new key value pair to existing database HOT 1
- Cannot find module 'lowdb/node' or its correspoing type declaractions HOT 4
- Why Json File is pretty HOT 1
- JSONFile path error HOT 2
- db.json updates but db.value() does not show it in terminal HOT 1
- Throws ERR_INVALID_URL HOT 6
- Think again if you don't want to deal with bunch of documents just because of this ESM forcing. HOT 1
- pnpm 安装后使用报错 HOT 1
- Problems with setting up a small helloWorld HOT 3
- .
- error TS1192: Module '"node:fs"' has no default export. HOT 1
- Uncaught TypeError: (0 , import_node_path.dirname) is not a function HOT 1
- Compare the advantages of localForage HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lowdb.