diff --git a/docs/X4N03xLYEWnN.html b/docs/X4N03xLYEWnN.html index dca059b84..b8e844cba 100644 --- a/docs/X4N03xLYEWnN.html +++ b/docs/X4N03xLYEWnN.html @@ -43,7 +43,7 @@ Error: The module '/Users/elian/Projects/Notes/node_modules/better-sqlite3/build was compiled against a different Node.js version using NODE_MODULE_VERSION 108. This version of Node.js requires NODE_MODULE_VERSION 116. Please try re-compiling or re-installing -the module (for instance, using `npm rebuild` or `npm install`).

How the natives are handled

Locally, this can be fixed by rebuilding the binaries, which is what npm run switch-electron does, which uses electron-rebuild under the hood.

When the deliveries are built (see Build deliveries locally), it is not feasible to rebuild the dependencies since we are building for multiple platforms. Luckily, better-sqlite3 provides these prebuilt binaries from us, available as artifacts on their GitHub releases page

The build script manages the natives for better-sqlite3 by keeping a copy of the .node file for every platform in bin/better-sqlite3.

Whenever the version of better-sqlite3 changes, the .node files must also be renewed based on their releases page. To simplify this process, a script was created in bin/better-sqlite3/update.sh.

How to update the natives

The update script needs to know the version of Electron or Node.js for which to download the prebuilt binaries.

If you get errors during download, check on the releases page to ensure that this particular combination of Electron/Node actually exists for the given release.

To determine the NODE_MODULE_VERSION that is required, look for This version of Node.js requires
NODE_MODULE_VERSION in the error when starting Trilium via:

Check which files got changed after running the update script and for each platform that got changed, test it locally via Build deliveries locally or via the CI.

+the module (for instance, using `npm rebuild` or `npm install`).

How the natives are handled

Locally, this can be fixed by rebuilding the binaries, which is what npm run electron:switch does, which uses electron-rebuild under the hood.

When the deliveries are built (see Build deliveries locally), it is not feasible to rebuild the dependencies since we are building for multiple platforms. Luckily, better-sqlite3 provides these prebuilt binaries from us, available as artifacts on their GitHub releases page

The build script manages the natives for better-sqlite3 by keeping a copy of the .node file for every platform in bin/better-sqlite3.

Whenever the version of better-sqlite3 changes, the .node files must also be renewed based on their releases page. To simplify this process, a script was created in bin/better-sqlite3/update.sh.

How to update the natives

The update script needs to know the version of Electron or Node.js for which to download the prebuilt binaries.

If you get errors during download, check on the releases page to ensure that this particular combination of Electron/Node actually exists for the given release.

To determine the NODE_MODULE_VERSION that is required, look for This version of Node.js requires
NODE_MODULE_VERSION in the error when starting Trilium via:

Check which files got changed after running the update script and for each platform that got changed, test it locally via Build deliveries locally or via the CI.

diff --git a/docs/btM6L9JtG301.html b/docs/btM6L9JtG301.html index 6188237d3..f8a6b4701 100644 --- a/docs/btM6L9JtG301.html +++ b/docs/btM6L9JtG301.html @@ -38,7 +38,7 @@
-

Run server

Run with default settings:

npm run server:start

Run with custom port:

TRILIUM_PORT=8082 npm run server:start

Run Electron

Rebuild better-sqlite3 dependency:

npm run switch-electron

Then run Electron:

npm run electron:start

To run Electron using the same data directory as the production version:

npm run electron:start-no-dir

When done, switch back the better-sqlite3 dependency:

npm run server:switch
+

Run server

Run with default settings:

npm run server:start

Run with custom port:

TRILIUM_PORT=8082 npm run server:start

Run Electron

Rebuild better-sqlite3 dependency:

npm run electron:switch

Then run Electron:

npm run electron:start

To run Electron using the same data directory as the production version:

npm run electron:start-no-dir

When done, switch back the better-sqlite3 dependency:

npm run server:switch