Skip to content

Commit 1a4523a

Browse files
authored
Merge pull request #64 from journeyapps/update-docs-electron
Add notes on electron-forge
2 parents 5d77a5a + 3870217 commit 1a4523a

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ A copy of the source for SQLCipher 4.4.0 is bundled, which is based on SQLite 3.
5555

5656
## Building from source.
5757

58-
This is done automatically by node-pre-gyp when installing on a platform without pre-built binaries.
58+
This is done automatically by node-pre-gyp when installing on a platform without pre-built binaries. This should generally
59+
not be required with later versions, since two pre-built versions (N-API 3 and N-API 6) cover all electron and node versions.
60+
5961
However, this does require some additional setup, and is likely to run against obscure errors when installing.
6062

6163
Requirements:
@@ -69,6 +71,28 @@ Requirements:
6971
* Visual Studio 2015
7072
* Python 2.7
7173

74+
## Usage with electron-forge / electron-rebuild
75+
76+
[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
77+
that is _not_ compatible with the way `node-pre-gyp` is used here.
78+
79+
The workaround is to disable the rebuilding:
80+
1. If using Electron 11+, use a node version that supports N-API 6+ (v10.20.0+ / v12.17.0+ / v14.0.0).
81+
2. After `npm install` / `yarn install`, make sure that the folder `node_modules/@journeyapps/sqlcipher/lib/binding/napi-v6-linux-x64` exists.
82+
If not, check the previous step again, remove the `node_modules` folder, and try again.
83+
3. Disable rebuilding of this library using the `onlyModules` option of `electron-rebuild` in your `package.json`:
84+
85+
"config": {
86+
"forge": {
87+
"electronRebuildConfig": {
88+
"onlyModules": [] // Specify other native modules here if required
89+
}
90+
}
91+
}
92+
93+
Note: [electron-builder](https://www.electron.build/) does not appear to have this issue, and should work directly.
94+
Similarly, using electron directly should just work, but do check that a compatible node version is used (see above).
95+
7296
## OpenSSL
7397

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

0 commit comments

Comments
 (0)