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

Can't run sqlcipher on Windows #56

Closed
benpratt22 opened this issue Oct 22, 2020 · 11 comments
Closed

Can't run sqlcipher on Windows #56

benpratt22 opened this issue Oct 22, 2020 · 11 comments

Comments

@benpratt22
Copy link

benpratt22 commented Oct 22, 2020

node-v : v12.19.0

Hi, I can't seem to be able to get sqlcipher running on Windows. I've created a repo of the minimal problem. Help would be appreciated. Thank you!

Steps to repro are here:
https://github.com/benprattinduction/sqlcipher_windows_issue

  1. yarn install
  2. try yarn run start (will get errors on rebuild step, can fix by renaming below)
    rename node_modules/@journeyapps/sqlcipher/lib/binding/napi-v6-win32-x64 TO node_modules/@journeyapps/sqlcipher/lib/binding/napi-v3-win32-x64
  3. uncomment ln33 in main.js, it will throw error below

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 'start' 1 verbose cli ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle [email protected]: [email protected] 6 info lifecycle [email protected]: [email protected] 7 verbose lifecycle [email protected]: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\ben.p\Documents\electron_test\node_modules.bin;C:\Python39\Scripts;C:\Python39;C:\Program Files (x86)\Parallels\Parallels Tools\Applications;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Yarn\bin;C:\Users\ben.p\AppData\Local\Microsoft\WindowsApps;;C:\Users\ben.p\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ben.p\AppData\Roaming\npm;C:\Users\ben.p\AppData\Local\Yarn\bin 9 verbose lifecycle [email protected]: CWD: C:\Users\ben.p\Documents\electron_test 10 silly lifecycle [email protected]: Args: [ '/d /s /c', 'electron .' ] 11 silly lifecycle [email protected]: Returned: code: 3228369023 signal: null 12 info lifecycle [email protected]: Failed to exec start script 13 verbose stack Error: [email protected] start: 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:1021:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) 14 verbose pkgid [email protected] 15 verbose cwd C:\Users\ben.p\Documents\electron_test 16 verbose Windows_NT 10.0.19041 17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" 18 verbose node v12.19.0 19 verbose npm v6.14.8 20 error code ELIFECYCLE 21 error errno 3228369023 22 error [email protected] start: electron . 22 error Exit status 3228369023 23 error Failed at the [email protected] start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 3228369023, true ]

@ion-dev
Copy link

ion-dev commented Dec 2, 2020

Hi @benpratt22 which version of Electron are you using?

I can confirm that sqlcipher causes an error in electron >v8 when launching the windows application (after build).

It's working for me on electron 7.1.7 but fails to launch the app in electron v8.5.5 (which is the minimum we need).

@benpratt22
Copy link
Author

Hi @ion-dev we were using electron 9, we're now onto Electron 11. We ended up just using realm.

@dev-manager-uk
Copy link

@journeyapps/sqlcipher - 5.0.0
node - v12.20.0
electron - 11.0.4
electron-rebuild - 2.3.4

Using the repo from above:
https://github.com/benprattinduction/sqlcipher_windows_issue

I needed to have both:
\node_modules@journeyapps\sqlcipher\lib\binding\napi-v3-win32-x64
and
\node_modules@journeyapps\sqlcipher\lib\binding\napi-v6-win32-x64

Otherwise I was getting "Uncaught Exception: Error: Cannot find module"

There's some problem with the naming of these folders in v5.0.0

However once past that I get the same error as above:

error Command failed with exit code 3228369023.

err

@1111mp
Copy link

1111mp commented Jan 6, 2021

@journeyapps/sqlcipher - 5.0.0
node - v12.17.0
electron - 11.0.1
electron-rebuild - 2.3.2

Compilation can pass.But an error will be reported when creating the table.
image
If this line of code is commented out, there is no problem.
image

@1111mp
Copy link

1111mp commented Jan 6, 2021

I found a solution from here:#60
Marcus Green's commit.
package.json:

"binary": {
    "module_name": "node_sqlite3",
    "module_path": "./lib/binding/napi-v3-{platform}-{arch}",
    "host": "https://journeyapps-node-binary.s3.amazonaws.com",
    "remote_path": "./{name}/v{version}/{toolset}/",
    "package_name": "napi-v3-{platform}-{arch}.tar.gz"
  },

@1111mp
Copy link

1111mp commented Jan 6, 2021

This method can be run in a development environment, but the same error is reported after packaging.
Hope there is a solution.

@dev-manager-uk
Copy link

Here's what worked for us: https://github.com/dev-manager-uk/node-sqlcipher

Hope there might be something useful there for you :-)

@1111mp
Copy link

1111mp commented Jan 6, 2021

I tried it, but there will still be errors after electron packaging.

@1111mp
Copy link

1111mp commented Jan 7, 2021

I have this problem in both the 11.0.1 and 11.0.4 versions of electron

@rkistner
Copy link
Member

Do not rename that folder - it only superficially hides the issue, and it is likely to cause a crash. You need to get the correct bindings installed.

I've added new instructions on workarounds here: https://github.com/journeyapps/node-sqlcipher/blob/3870217c1245dd4253e2bac2ea8d1d12a8c4a2b6/README.md#usage-with-electron-forge--electron-rebuild

@1111mp
Copy link

1111mp commented Jan 13, 2021

@rkistner Thank you very much.

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

No branches or pull requests

5 participants