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

Add notes on electron-forge #64

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ A copy of the source for SQLCipher 4.4.0 is bundled, which is based on SQLite 3.

## Building from source.

This is done automatically by node-pre-gyp when installing on a platform without pre-built binaries.
This is done automatically by node-pre-gyp when installing on a platform without pre-built binaries. This should generally
not be required with later versions, since two pre-built versions (N-API 3 and N-API 6) cover all electron and node versions.

However, this does require some additional setup, and is likely to run against obscure errors when installing.

Requirements:
Expand All @@ -69,6 +71,28 @@ Requirements:
* Visual Studio 2015
* Python 2.7

## Usage with electron-forge / electron-rebuild

[electron-forge](https://www.electronforge.io/) uses [electron-rebuild](https://github.com/electron/electron-rebuild) and attempts to rebuild this library from source by default, in a way
that is _not_ compatible with the way `node-pre-gyp` is used here.

The workaround is to disable the rebuilding:
1. If using Electron 11+, use a node version that supports N-API 6+ (v10.20.0+ / v12.17.0+ / v14.0.0).
2. After `npm install` / `yarn install`, make sure that the folder `node_modules/@journeyapps/sqlcipher/lib/binding/napi-v6-linux-x64` exists.
If not, check the previous step again, remove the `node_modules` folder, and try again.
3. Disable rebuilding of this library using the `onlyModules` option of `electron-rebuild` in your `package.json`:

"config": {
"forge": {
"electronRebuildConfig": {
"onlyModules": [] // Specify other native modules here if required
}
}
}

Note: [electron-builder](https://www.electron.build/) does not appear to have this issue, and should work directly.
Similarly, using electron directly should just work, but do check that a compatible node version is used (see above).

## OpenSSL

SQLCipher depends on OpenSSL. When using NodeJS, OpenSSL is provided by NodeJS itself. For Electron, we need to use our own copy.
Expand Down