Skip to content

How to use oracledb in an electron app #918

@n-riesco

Description

@n-riesco

I'm opening this issue to describe two approaches for using oracledb v2.2 in an electron app:

  1. Using electron-rebuild

    The key for this approach to work is to:

    • ensure that nan v2.8+ is listed amongst the dev dependencies (otherwise, electron-rebuild will fail with nan-related errors)
    • and run electron-rebuild at the postinstall step.

    I've created the repo oracledb-electron-rebuild with a working example.

  2. Using electron-builder

    The key for this approach to work is to:

    • use the source package from github:
      npm install --save https://github.com/oracle/node-oracledb/releases/download/v2.2.0/oracledb-src-2.2.0.tgz
      
    • and run electron-builder install-app-deps at the postinstall step.

    See the repo oracledb-electron-builder for a working example.


The reason for using the source package from github (instead of the package distributed via npm) is that, unlike the package from github, the npm package runs node package/oracledbinstall.js at the install step.

The purpose of oracledbinstall.js is to download prebuilt binaries built against node. Unfortunately, this script is unaware of the npm environment variables used for building electron apps and prevents node-gyp rebuild from running when building oracledb against electron.


A suggestion: prebuild (a tool for creating prebuilt binaries) and prebuilt-install (for installing them) are both aware of electron.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions