error after hard reboot
See original GitHub issueI’m using node-persist
on a raspberry pi where there is no on/off button to gracefully stop or reboot the machine. Therefore, I pull the usb (power) cable and plug it back in. This works for most applications, but I encounter the following problem in one of my apps:
I’m initializing the storage module synchronically like this:
storage.initSync({ttl: 8 * 60 * 60 * 1000})
Usually, after a hard reboot I get this stack trace in my log file:
TypeError: Cannot read property 'key' of undefined
at LocalStorage.parseFileSync (/home/pi/lavazza/dash-button/node_modules/node-persist/src/local-storage.js:638:24)
at LocalStorage.parseStorageDirSync (/home/pi/lavazza/dash-button/node_modules/node-persist/src/local-storage.js:602:26)
at LocalStorage.initSync (/home/pi/lavazza/dash-button/node_modules/node-persist/src/local-storage.js:148:14)
at Object.nodePersist.initSync (/home/pi/lavazza/dash-button/node_modules/node-persist/src/node-persist.js:37:32)
at Object.<anonymous> (/home/pi/lavazza/dash-button/index.js:15:9)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
Line 15 in file index.js
corresponds to the storage.initSync
I quoted above.
Deleting the .node-persist
directory resolves the problem. So this is my workaround for the time being, but it would be cleaner if I wouldn’t have to. Do you have an idea why this happens?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
"There was a problem when resetting your PC. No changes ...
Open an elevated command prompt. To do this, click Start, type Command Prompt or cmd in the Search box, right-click Command Prompt, and...
Read more >FIXED: There Was a Problem Resetting Your PC (7 Solutions)
#1) Open settings and click on “Update & security,” as shown in the image below. ... #2) Now, click on “Recovery” and then...
Read more >How to Fix Windows 10 Reset Failed (6 Effective Ways)
This factory reset error may be caused a corrupted file like .dll. To solve it, you can try SFC command prompt. Open command...
Read more >Can't Reset Windows 10? 5 Ways to Fix It Now
How do I force a factory reset on Windows 10? · 1. Use specialized software · 2. Use a system restore point ·...
Read more >Best 5 Ways to Fix Restart to Repair Drive Errors
Hard drives errors usually occur due to hardware failure, power outages, poor system maintenance, malware attacks, or even human errors. You can ...
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
i think i do, something is adding a non-parseable file in that directory, i think these 2 issues are related: can you add a logging statement, as my instructions in this comment https://github.com/simonlast/node-persist/issues/72#issuecomment-264754099
Yes, I will do that, you’re right.