journeyapps / node-sqlcipher

SQLCipher bindings for Node
https://journeyapps.com
BSD 3-Clause "New" or "Revised" License
207 stars 66 forks source link

Electron crash on Windows on v5.0.0 #67

Closed sandeepsow closed 3 years ago

sandeepsow commented 3 years ago

"electron": "^11.1.0", "@journeyapps/sqlcipher": "^5.0.0", node version: 12.20.0 npm version: 6.14.8

error:

npm ERR! code ELIFECYCLE npm ERR! errno 3228369023 npm ERR! ITDe-Filing-Forms@1.0.1 ele: electron . npm ERR! Exit status 3228369023 npm ERR! npm ERR! Failed at the app@1.0.1 ele script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2021-01-27T13_27_23_388Z-debug.log

The electron exe is closing if I run db.run("PRAGMA key ='mySecret'");

Could you please help on this.

rkistner commented 3 years ago

The output from above doesn't say much unfortunately.

To debug:

  1. Check the known issue here: #65.
  2. Check the debug log file mentioned in the output.
  3. Run electron directly, instead of via NPM.
sandeepsow commented 3 years ago

hey, thanks for the quick response. please find complete log.

Am using "electron-builder": "^22.9.1",

0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'ele' 1 verbose cli ] 2 info using npm@6.14.8 3 info using node@v12.20.0 4 verbose run-script [ 'preele', 'ele', 'postele' ] 5 info lifecycle app@1.0.1~preele: app@1.0.1 6 info lifecycle app@1.0.1~ele: app@1.0.1 7 verbose lifecycle app@1.0.1~ele: unsafe-perm in lifecycle true 8 verbose lifecycle app@1.0.1~ele: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Administrator\Downloads\app\node_modules.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\PuTTY\;C:\Program Files\nodejs\;C:\Users\Administrator.windows-build-tools\python27\;C:\Users\Administrator.windows-build-tools\python27\;C:\Users\Administrator.windows-build-tools\python27\;C:\Users\Administrator.windows-build-tools\python27\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Roaming\npm 9 verbose lifecycle app@1.0.1~ele: CWD: C:\Users\Administrator\Downloads\app 10 silly lifecycle app@1.0.1~ele: Args: [ '/d /s /c', 'electron .' ] 11 silly lifecycle app@1.0.1~ele: Returned: code: 3228369023 signal: null 12 info lifecycle app@1.0.1~ele: Failed to exec ele script 13 verbose stack Error: app@1.0.1 ele: electron . 13 verbose stack Exit status 3228369023 13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:314:20) 13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:314:20) 13 verbose stack at maybeClose (internal/child_process.js:1022:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) 14 verbose pkgid app@1.0.1 15 verbose cwd C:\Users\Administrator\Downloads\app 16 verbose Windows_NT 10.0.18363 17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "ele" 18 verbose node v12.20.0 19 verbose npm v6.14.8 20 error code ELIFECYCLE 21 error errno 3228369023 22 error app@1.0.1 ele: electron . 22 error Exit status 3228369023 23 error Failed at the app@1.0.1 ele script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 3228369023, true ]

jsavage86 commented 3 years ago

I’m having the exact same problem no matter if I’m using electron by itself or electron forge on Windows. It runs fine when there is no pragma key but crashes if I try to create an encrypted database. I’m running the example from the readme.

Node 12.18.3 Chrome 87.0.4280.141 Electron 11.2.3

rkistner commented 3 years ago

70 should fix this issue.

For future reference on debugging a crash like this, this is a good guide: https://felixrieseberg.com/debugging-electron-apps-on-windows/

In my case, crash reports were not created automatically. What did help is enabling electron's crashReporter:

// In main process
const { crashReporter, app } = require('electron');

crashReporter.start({submitURL: ''});
console.log('Crash reports will be logged to:', app.getPath('crashDumps'));
rkistner commented 3 years ago

Fix released in v5.1.0.

ajmasia commented 3 years ago

Thanks, @rkistner for the solution. Now works fine on windows 💪