level: IO Error in packaged Electron app
I’m making an Electron app with LevelDB and want to use asar in packaging, but at startup it gives this error:
Uncaught Exception:
OpenError: IO error: ./hypershare.db/LOCK: No such file or directory
at /Users/gerhard/dev/node/hypershare-app/dist/Hypershare-darwin-x64/Hypershare.app/Contents/Resources/app.asar/node_modules/levelup/lib/levelup.js:119:34
at /Users/gerhard/dev/node/hypershare-app/dist/Hypershare-darwin-x64/Hypershare.app/Contents/Resources/app.asar/node_modules/leveldown/node_modules/abstract-leveldown/abstract-leveldown.js:39:16
I tried to unpack the file that creates the db, so it isn’t in the .asar
file, but it gives the same error.
If I don’t use asar it works though.
How could I avoid this error?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (5 by maintainers)
Thank you, @ralphtheninja . Yeah, I found it. Actually @BrunoBernardino 's answer have solved my problem. Thanks, bro. But I did not notice that I run
electron:serve
and open the packaged app at the same time.@Alecyrus here’s the relevant code (sorry, that repo/app got sold and is no longer publicly available):
Basically the main problem here was PouchDB couldn’t access that app location, but electron can access the
appData
path, which will depend on the OS.I hope that helps!
Happy you managed to solve it! Closing this issue, if you don’t mind 😃