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

Finlight should propopse creating a new database if the one expected does not exist #22

Closed
fmartingr opened this issue Oct 6, 2024 · 5 comments · Fixed by #27
Closed

Comments

@fmartingr
Copy link

Details: Finlight 2.0.1, MacBookPro M2 Pro, macOS Sequoia

Can't start the app. It stays open (in the dock) but no window shows up.

CleanShot 2024-10-06 at 09 21 11

Uncaught Exception:
TypeError: Cannot open database because the directory does not exist
at new Database (/Users/fmartingr/Downloads/Finlight.app/Contents/Resources/app.asar/node_modules/better-sqlite3/lib/database.js:65:9)
at Jn (/Users/fmartingr/Downloads/Finlight.app/Contents/Resources/app.asar/.vite/build/main.js:1:974)
at Do (/Users/fmartingr/Downloads/Finlight.app/Contents/Resources/app.asar/.vite/build/main.js:41:84148)
at Object.<anonymous> (/Users/fmartingr/Downloads/Finlight.app/Contents/Resources/app.asar/.vite/build/main.js:41:84040)
at Module._compile (node:internal/modules/cjs/loader:1373:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
at Module.load (node:internal/modules/cjs/loader:1215:32)
at Module._load (node:internal/modules/cjs/loader:1031:12)
at c._load (node:electron/js2c/node_init:2:17025)
at node:electron/js2c/browser_init:2:129092
@dsaltares
Copy link
Owner

Thanks @fmartingr!

Finlight tries to create the db if it doesn't exist. It may not be creating the full path recursively to access it. Just to confirm, can you let me know the contents of your userSettings.json

cat ~/Library/Application Support/finlight/userSettings.json

And does the dataPath exist? In my case this would be:

{
  "version": 1,
  "settings": {
    "dataPath": "/Users/davidsaltares/Library/CloudStorage/[email protected]/My Drive/finlight"
  }
}

@fmartingr
Copy link
Author

~/Library/Application Support/finlight/

That folder does not exist in my machine.

@dsaltares
Copy link
Owner

@fmartingr are you sure?

Application Support is a hidden folder by default on mac. And Electron's app.getPath('userData') on mac returns ~/Library/Application Support/<app_name>.

Perhaps it doesn't exist because you're running it directly off the Downloads folder? I will also ensure that folder exists.

@dsaltares
Copy link
Owner

Updated #27 to include that.

dsaltares added a commit that referenced this issue Oct 18, 2024
fix: #22 ensure data folder exists at startup
@jerry-ne
Copy link

Hi, please reopen issue. v2.0.3 still persist on Debian.

finlight
Ensuring data directory exists /home/jerry/.config/Finlight/data
Using database at /home/jerry/.config/Finlight/data/db.sqlite
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Cannot open database because the directory does not exist
at new Database (/usr/lib/finlight/resources/app.asar/node_modules/better-sqlite3/lib/database.js:65:9)
at Kn (/usr/lib/finlight/resources/app.asar/.vite/build/main.js:1:1167)
at Wo (/usr/lib/finlight/resources/app.asar/.vite/build/main.js:41:84178)
at Object. (/usr/lib/finlight/resources/app.asar/.vite/build/main.js:41:84070)
at Module._compile (node:internal/modules/cjs/loader:1373:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
at Module.load (node:internal/modules/cjs/loader:1215:32)
at Module._load (node:internal/modules/cjs/loader:1031:12)
at c._load (node:electron/js2c/node_init:2:17025)
at node:electron/js2c/browser_init:2:129092
^Cjerry@NTB:~/Downloads$ mkdir -p /.config/Finlight/data
jerry@NTB:
/Downloads$ finlight
Ensuring data directory exists /home/jerry/.config/Finlight/data
Using database at /home/jerry/.config/Finlight/data/db.sqlite
Ensuring data directory exists /home/jerry/.config/Finlight/data
Using database at /home/jerry/.config/Finlight/data/db.sqlite
migration "0001-createTables" was executed successfully
migration "0002-attachments" was executed successfully
[13133:1031/052725.255297:ERROR:nss_util.cc(345)] After loading Root Certs, loaded==false: NSS error code: -8018
tRPC OK - getAccounts.query - 1.192ms
tRPC OK - getCSVImportPresets.query - 0.313ms

After manually creating dir, it works.

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

Successfully merging a pull request may close this issue.

3 participants