question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error after hard reboot

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
akhourycommented, Mar 8, 2017

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

0reactions
jfixcommented, Mar 10, 2017

Yes, I will do that, you’re right.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found