Deleting Storage Folder throws error on first start
See original GitHub issueHello,
Not sure if this is a Problem of node-persist or Node but when I delete the Storage Folder a ENOENT error is thrown on first start.
Error: ENOENT: no such file or directory, open 'd:\path\to\project\projectname\server\storage\hash'
It fixes itself if you just restart the app but It cripples my deployment script. Is there a Cache File somewhere I need to delete?
Thanks for the Help
Issue Analytics
- State:
- Created 7 years ago
- Comments:9
Top Results From Across the Web
7 Solutions to Delete a File or Folder Showing Error “Access Is ...
Here is the step by step process of deleting a file/folder that is undeletable: First, open CMD: press the start button and type...
Read more >2021 Guide: Fix 'Unable to Delete Folders/Files from External ...
The best practice is to find out the actual cause of why the can't delete files error is triggered in the first place....
Read more >[Solved] Unable to Delete a Folder In Windows 10 - mulcas
Solution · Option 1: Restart Windows File Explorer · Option 2: Remove the folder using Windows Command-line · Option 3: Rename the folder...
Read more >Can't delete files on NTFS file system - Windows Server
This article describes why can't delete a file or a folder on an NTFS file system volume. It also provides help to solve...
Read more >Fix “Could Not Find This Item” When Deleting in Windows
If you still can't delete the file and it keeps throwing the “could not find this item” error, you can try deleting the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok, so here’s what’s happening, you’re trying to
setItem()
before the storage has finished initializing, and creating the the storage directory, that’s why it only does it the first time, the second time the directory is already created.When you use
storage.init()
, it’s asynchronous, you need to wait for it to be ready before you can use thestorage
This is my fault, the example in the README was wrong, I just fixed it
you can solve this in 2 ways, either,
Wait for it to be done, before using it
OR
Use the synchronous version of
init
- this is OK if you are doing it once at app-load time, it will not really impact performanceThank you for the quick fix - i just tested it and it works fine.
Somehow I didn’t think of testing the Problem without setting a variable 😃
Code for reference: