-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
How to use oracledb in an electron app #918
Comments
Good stuff, @n-riesco. Thanks! |
This will be really helpful. Thanks for posting. |
I cannot get this to work on Windows using the latest release of oracledb C:\Development\oracledb>python -V
PS C:\Development\oracledb> npm install --global --production windows-build-tools
C:\Development\oracledb\node_modules\oracledb>if not defined npm_config_node_gyp (node "C:\Users\Mark D Drake\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\Mark D Drake\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) npm ERR! code ELIFECYCLE npm ERR! A complete log of this run can be found in: The problem appears to be related to the file compiler.ast, which is not found udner the node_modules FWITW I am using the Python distribution from Python.org |
It's not clear why source code is being used instead of pre-built binaries. Didn't electron sort out its ABI incompatibilities a while back? |
Chris Are you suggesting I should be able to to an npm install oracbledb and everything should work. If I do this then I get Uncaught Error: NJS-045: cannot load the oracledb add-on binary for Node.js 10.2.0 (win32, x64) Cannot load C:\Development\YADAMU\oracle\node\node_modules\oracledb\build\Release\oracledb.node A dynamic link library (DLL) initialization routine failed. \?\C:\Development\YADAMU\oracle\node\node_modules\oracledb\build\Release\oracledb.node Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html You must have 64-bit Oracle client libraries in your PATH environment variable. If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from http://www.oracle.com/technetwork/topics/winx64soft-089540.html A Microsoft Visual Studio Redistributable suitable for your Oracle client library version must be available. at Object. (C:\Development\YADAM…\lib\oracledb.js:68) at Object. (C:\Development\YADAM…lib\oracledb.js:696) at Module._compile (internal/modules/cjs/loader.js:711) at Object.Module._extensions..js (internal/modules/cjs/loader.js:722) at Module.load (internal/modules/cjs/loader.js:620) at tryModuleLoad (internal/modules/cjs/loader.js:559) at Function.Module._load (internal/modules/cjs/loader.js:551) at Module.require (internal/modules/cjs/loader.js:658) at require (internal/modules/cjs/helpers.js:20) at Object. (C:\Development\YADAM…oracledb\index.js:1) I do have the Oracle Instant client bin in my path before you ask. If I run a node app that uses oracledb from the same command window it works fine. Dan pointed me at this thread as a solution to the problem.. |
I was wondering why https://github.com/n-riesco/oracledb-electron-builder/blob/master/package.json#L59 used source and not just '~3.0' to get the binaries. |
@cjbj I discussed the reason at the bottom of this comment. In Windows, I found that electron fails to |
@n-riesco thanks for chiming in. Do you have any thoughts on @markddrake's issue? |
The logs show that @markddrake, are you able to run |
And I can't find a file called compiler.ast on my computer.. FWiW I installed Python using https://www.python.org/ftp/python/2.7.15/python-2.7.15.amd64.msi |
Hi @n-riesco, thanks a lot for writing this! |
@starvikas009 I used |
@markddrake Do you also have Python 3 on that machine? What does If you get
|
I'm opening this issue to describe two approaches for using
oracledb
v2.2 in an electron app:Using electron-rebuild
The key for this approach to work is to:
nan
v2.8+ is listed amongst the dev dependencies (otherwise,electron-rebuild
will fail withnan
-related errors)electron-rebuild
at the postinstall step.I've created the repo oracledb-electron-rebuild with a working example.
Using electron-builder
The key for this approach to work is to:
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 runsnode 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 preventsnode-gyp rebuild
from running when buildingoracledb
against electron.A suggestion: prebuild (a tool for creating prebuilt binaries) and prebuilt-install (for installing them) are both aware of electron.
The text was updated successfully, but these errors were encountered: