Skip to content

Commit

Permalink
Merge pull request #64 from journeyapps/update-docs-electron
Browse files Browse the repository at this point in the history
Add notes on electron-forge
  • Loading branch information
rkistner authored Jan 13, 2021
2 parents 5d77a5a + 3870217 commit 1a4523a
Showing 1 changed file with 25 additions and 1 deletion.
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

0 comments on commit 1a4523a

Please sign in to comment.