Skip to content

Uncaught Error: NJS-045: cannot load the oracledb add-on binary for Node.js 7.9.0 #818

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

Closed
kwent opened this issue Dec 28, 2017 · 24 comments
Closed

Comments

@kwent
Copy link

kwent commented Dec 28, 2017

Hi,

So i spent a fair amount of time trying to make my electron app works. I followed the installation guide with Zip File method but i hit the issue below which prevent the all app to start.

Uncaught Error: NJS-045: cannot load the oracledb add-on binary for Node.js 7.9.0 (linux, x64)
Cannot load /home/osboxes/app/release/linux-unpacked/resources/app.asar/node_modules/oracledb/build/Release/oracledb.node
The module '/tmp/.org.chromium.Chromium.QS5Iaa'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 54. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
Node-oracledb installation instructions: https://github.com/oracle/node-oracledb/blob/master/INSTALL.md
You must have 64-bit Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig.
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/linuxx86-64soft-092277.html

The system node version used is v8.2.0. So i have no idea why the error message is mentioning v7.9.0 ?

I installed nvm and switch to 7.9.0 version and same issue.

Not sure about NODE_MODULE_VERSION message as well. 54 is referencing to any nodejs version when i take a look at the official page: https://nodejs.org/en/download/releases/

I tried to rebuild extension but nothing i get stuck with this message. Any idea ?

Regards

@dmcghan
Copy link

dmcghan commented Dec 28, 2017

@kwent This line "The module '/tmp/.org.chromium.Chromium.QS5Iaa'..." seems suspect.

What version of Electron are you running?

What version of the driver (node-oracledb) are you using?

What do you get if you run: console.log(process.versions)?

Sorry, it's been a while, but when do dependencies of your Electron app get installed/compiled?

You may need to pick your Node.js version, then install Electron, then install the driver. After that, don't change your Node.js version unless you want to reinstall Electron and the driver.

@kwent
Copy link
Author

kwent commented Dec 29, 2017

@dmcghan Here is a demo repo i can repro the issue: https://github.com/kwent/electron-react-boilerplate

virtualbox_ubuntu_29_12_2017_01_51_54

You can download .deb artifact at : https://circleci.com/gh/kwent/electron-react-boilerplate/2#artifacts/containers/0

circle.yml is pretty simple and straigforward: https://github.com/kwent/electron-react-boilerplate/blob/master/circle.yml

Let me know what you think...

Regards

@kwent kwent changed the title Uncaught Error: NJS-045: cannot load the oracledb add-on binary for Node.js 7.9.0 (linux, x64) Uncaught Error: NJS-045: cannot load the oracledb add-on binary for Node.js 7.9.0 Dec 29, 2017
@kwent
Copy link
Author

kwent commented Dec 29, 2017

Alright so it's also happening on OSX and windows.

It is because electron 1.7.x (stable release) is using module ABI 54 and none of your precompiled libraries supports it.

screen shot 2017-12-29 at 4 16 07 pm

How complicated would it be to precompile for module ABI 54 for all platforms your side for all electron users ?

Regards

@dmcghan
Copy link

dmcghan commented Dec 29, 2017

@kwent As far as I know, the plan is only to support Node.js versions that have LTS (even numbers).

I'm kinda surprised Electron is using odd numbers...

Are you unable to compile the binaries? What do you get with this?
npm install oracle/node-oracledb.git#v2.0.15

@dmcghan
Copy link

dmcghan commented Dec 29, 2017

@kwent I'm happy to look into this more for you, but I'm unable to reproduce with the links you provided. Please provide a script I can use to reproduce (or steps).

@kwent
Copy link
Author

kwent commented Dec 29, 2017

@dmcghan electron-builder is using node-abi library to resolve abi version while compiling and look what i found: https://github.com/lgeiger/node-abi/blob/master/index.js#L64

To repro:

$ git clone [email protected]:kwent/electron-react-boilerplate.git
$ cd electron-react-boilerplate
$ cd app && yarn && cd ..
$ yarn
$ npm run dev (open developer tools to see error message)

I'm having issues building from source cause yarn related to odpi lib not found (i read some issues with yarn and postinstall on their repo). Work with npm but my entired build system is on top of yarn and i don't want to change this.

@kwent
Copy link
Author

kwent commented Dec 30, 2017

@dmcghan Basically generate precompile binaries for module ABI 54 would fix my issue. Is this something possible to do ?

Regards

@dmcghan
Copy link

dmcghan commented Dec 30, 2017

@kwent That script didn't work for me...

Can you upgrade electron? Is the latest version using Node.js 8?

@kwent
Copy link
Author

kwent commented Dec 30, 2017 via email

@cjbj
Copy link
Member

cjbj commented Jan 7, 2018

There is some info on using yarn with node-oracledb in #794 (comment)

I'd really prefer not to release pre-built binaries for Node 7, since that adds another factor to testing.

@kwent
Copy link
Author

kwent commented Jan 7, 2018

I'm going to wait for electron v1.8.2 which should be released shortly and is using NodeJS 8

@kwent
Copy link
Author

kwent commented Feb 7, 2018

@dmcghan

Ok so 1.8.2 is released but i'm hitting a new issue on Windows only...

Uncaught Error: NJS-045: cannot load the oracledb add-on binary for Node.js 8.2.1 (win32, x64)
Cannot load C:\Users\kwent\app\release\win-unpacked\resources\app.asar\node_modules\oracledb\build\Release\oracledb.node
A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\username\AppData\Local\Temp\0beacf03-4f41-4b69-b407-0229886d6e9d.tmp.node
Node-oracledb installation instructions: https://github.com/oracle/node-oracledb/blob/master/INSTALL.md
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.

I tried to load the .node file reference in the error message:

> require('\\\\?\\C:\\Users\\kwent\\AppData\\Local\\Temp\\0beacf03-4f41-4b69-b407-0229886d6e9d.tmp.node')
Error: Module did not self-register.
    at Object.Module._extensions..node (module.js:664:18)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)ta\\Local\\Temp\\0beacf03-4f41-4b69-b407-0229886d6e9d.tmp.node')
    at Function.Module._load (module.js:489:3)ppData\Local\Temp\0beacf03-4f41-4b69-b407-0229886d6e9d.tmp.node'
    at Module.require (module.js:579:17)(module.js:536:15)
    at require (internal/module.js:11:18)66:25)
    at repl:1:1equire (module.js:579:17)
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at REPLServer.defaultEval (repl.js:240:29)
    at bound (domain.js:301:14)runInThisContext (vm.js:50:33)

When removing \\?\, looks like it's loading fine...

> require('C:\\Users\\kwent\\AppData\\Local\\Temp\\0beacf03-4f41-4b69-b407-0229886d6e9d.tmp.node')
{ Oracledb: [Function: Oracledb],
  Connection: [Function: Connection],
  Pool: [Function: Pool],
  ResultSet: [Function: ResultSet],
  ILob: [Function: ILob] }

This thread might help:
https://stackoverflow.com/questions/21194530/what-does-mean-when-prepended-to-a-file-path

Any idea ?

Edit:

After digging more i found same issue here: sass/node-sass#2149

I tried

> const trueCasePathSync = require('true-case-path')
> require(trueCasePathSync('\\\\?\\C:\\Users\\kwent\\AppData\\Local\\Temp\\0beacf03-4f41-4b69-b407-0229886d6e9d.tmp.node'))
{ Oracledb: [Function: Oracledb],
  Connection: [Function: Connection],
  Pool: [Function: Pool],
  ResultSet: [Function: ResultSet],
  ILob: [Function: ILob] }

Works well. So i think this is the fix !

Regards

@cjbj
Copy link
Member

cjbj commented Feb 7, 2018

@kwent good detective work; I'm sure that will help someone.

@kwent
Copy link
Author

kwent commented Feb 7, 2018

@cjbj The fix needs to be integrated in this lib:

Cf.

oracledbCLib = require(binaryReleasePath);

@cjbj
Copy link
Member

cjbj commented Feb 7, 2018

@kwent The problem with require() seems like a Node.js issue that should be fixed globally in Node.js, no?

@kwent
Copy link
Author

kwent commented Feb 7, 2018

@cjbj Sure although if we wanna make this library compatible for all nodejs version, we better have another fix here.

It's what node-sass ended up doing...

https://github.com/sass/node-sass/pull/2149/files

@kwent
Copy link
Author

kwent commented Feb 7, 2018

Might actually be another bug... will come back to you after some more tests.

@kwent
Copy link
Author

kwent commented Feb 8, 2018

Bug might come from https://github.com/chentsulin/electron-react-boilerplate

To repro (windows):

$ Follow instructions https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#-36-node-oracledb-installation-on-windows-with-instant-client-zip-files
$ set DEBUG_PROD=true
$ git clone [email protected]:kwent/electron-react-boilerplate.git
$ cd electron-react-boilerplate
$ cd app && yarn && cd ..
$ yarn
$ npm run dev (OK sometimes)
$ npm run package-win (Not OK)

Follow up here: electron-react-boilerplate/electron-react-boilerplate#1419

Regards

@kwent
Copy link
Author

kwent commented Feb 10, 2018

I'm still confused. Any help is welcome.

I still don't know if it's coming from this library, or something wrong in the boilerplate or even something wrong with electron...

@dtaipov
Copy link

dtaipov commented Feb 16, 2018

@cjbj I would need a precompiled library for Node.js 7.9.0 (NODE_MODULE_VERSION=51) for Windows. This version of Node is used by electron in VSCode, for which I'm trying to develop an extension using oracledb. According to this topic, Node version of electron "cannot be changed" there. I have troubles in compiling oracledb from source code because of the proxy issues. What may be an idea to make oracledb work with node 7.9.0?

@kwent
Copy link
Author

kwent commented Feb 16, 2018

@dtaipov One workaround is to upgrade electron to 1.8.2

@kwent
Copy link
Author

kwent commented Feb 17, 2018

This issue has been fixed with #851. Closing. Thanks !

@kwent kwent closed this as completed Feb 17, 2018
@cjbj
Copy link
Member

cjbj commented Feb 21, 2018

@heriipurnama
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants