Skip to content
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 './db.tmp.json' -> './db.json'] #8

Open
lslzl3000 opened this issue Mar 12, 2023 · 3 comments

Comments

@lslzl3000
Copy link

Screenshot 2023-03-13 at 02 06 20

@hugojerez
Copy link

I got a similar problem, can't use this library in a read-only stateless docker

How can I disable db.json file?

we need this fix-eature please 🥺🌻
image

@luandro
Copy link

luandro commented Jul 26, 2023

Nothing on this?

@GabrieleRisso
Copy link

I have the same problem, it has been a real headhake. My crappy patch has been to run this periodically: async function safeFileRename(sourcePath, destPath) {
try {
// Attempt to rename the file
await fs.promises.rename(sourcePath, destPath);
console.log(File renamed successfully: ${sourcePath} -> ${destPath});
} catch (error) {
if (error.code === "ENOENT") {
// Handle the case where the source file does not exist
console.error("[!!] Source file does not exist:", sourcePath);
} else {
// Handle other errors
console.error("[XX] Error renaming the file:", error.message);
}
}
}

const sourcePath = "./db.tmp.json";
const destPath = "./db.json";

				safeFileRename(sourcePath, destPath).catch((error) => {
					// Handle any uncaught errors here
					console.error("[XX] An unhandled error occurred:", error);
				});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants