Skip to content

Error: NJS-045: cannot load a node-oracledb binary for Node.js 12.0.0 (win32 x64) #1091

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
victorgianvechio opened this issue May 7, 2019 · 21 comments

Comments

@victorgianvechio
Copy link

I am developing an academic project with electron and oracle. My dbConnection.js file connects to the database and returns a success or error message.

When I run 'node dbConnection.js' the success message appears.

When I try to call the connection method in the electron application I get the following error: Error: NJS-045: Can not load a node-oracledb binary for Node.js 12.0.0 (win32 x64).

Windows 10 x64
Node v10.15.3
Oracle 11G
Phyton 3.7.3
VC Redist 2005/2013/2015/2019 (all these versions installed)

Any ideas how to solve the problem?

@cjbj
Copy link
Member

cjbj commented May 7, 2019

Since you're on Windows, my recommendation is to use Node 10 or 11. The alternative is to compile the module yourself. It's likely only the 4.0-dev version will compile, see #1085

@victorgianvechio
Copy link
Author

Sorry, I'm new with node. What do you mean by "compile the module yourself"? About the links you sent I followed the instructions but still without success.

I can connect in oracle and execute queries, my problem happens only when I am working with electron.

@cjbj
Copy link
Member

cjbj commented May 8, 2019

Use Node 10, which I see in your first post you had/have around. That has a prebuilt node-oracledb binary.

But if you need Node 12 you will have to build node-oracledb from source code using the branch I gave. Install instructions for building from source code are at https://oracle.github.io/node-oracledb/INSTALL.html#githubtags

@victorgianvechio
Copy link
Author

victorgianvechio commented May 8, 2019

Still giving error... Below the steps I used

Simple App
1- node -v: v10.15.3
2- npm i -S oracledb
3- tested my connection file and got: Connection successful

Electron App
1- node -v: v10.15.3
2- electron: 5.0.1
3- npm i -S oracledb
4- tested my connection file and got: Error: NJS-045: cannot load a node-oracledb binary for Node.js 12.0.0 (win32 x64) - but I'm still using node 10.15.3

I tried following the link instructions: npm install -S oracle/node-oracledb#v3.1.2
got the same error

@cjbj
Copy link
Member

cjbj commented May 9, 2019

If the message says you're using Node.js 12, then you're using Node.js 12.

Electron has its own special issues, since the V8 engine isn't exactly the same as the Node.js one that our binaries are built with. See #918 for some Electron help.

@max-pub
Copy link

max-pub commented Jun 14, 2019

When will you offer a pre-compiled binary for node 12?

@victorgianvechio
Copy link
Author

I Solved the problem using

"dependencies": {
        "oracledb": "github:oracle/node-oracledb#v3.1.2",
        "electron-rebuild": "^1.8.5",
 }

after installing the dependencies run ./node_modules/.bin/electron-rebuild

@cjbj
Copy link
Member

cjbj commented Jun 14, 2019

@max-pub precompile binaries will be available when node-oracledb 4 is released and 12 has bedded down a bit. Please help speed up the node-oracledb release process by testing v4, see #1053

@victorgianvechio that's great.

@tonydiep
Copy link

I'm experiencing this on a Windows and Linux machine

Uncaught Error: NJS-045: cannot load a node-oracledb binary for Node.js 12.0.0

I've double-checked and Node.js 12.0.0 is NOT installed on the Windows machine or Linux machine.

[tonydiep@tdlap15 vehicle-lookup]$  node --version
v10.16.0

I've tried rebuilding from source with electron-rebuild. Same results.

It's as if some dependency is specifying Node.js 12.0.0

@cjbj
Copy link
Member

cjbj commented Jul 15, 2019

@tonydiep If NJS-045 is saying you have Node 12, then that is what your Node is identifying itself as. I know Electron is 'special'. I'm surprised electron-rebuild isn't helping. Here is what I'd suggest: (i) trying the dev-4.0 branch, see #1053. There is even a binary available (ii) installing Node 12 and compiling.

@victorgianvechio
Copy link
Author

@tonydiep try deleting the node_modules folder and package-lock.json, then install the dependencies again and run the rebuild.

I have a simple app with oracle-db and electron.

@cjbj
Copy link
Member

cjbj commented Jul 16, 2019

@victorgianvechio thanks for sharing the tip and the app.

Have you tried it with the dev-4.0 code?


--- package.json.old	2019-07-16 10:16:16.000000000 +1000
+++ package.json	2019-07-16 10:16:48.000000000 +1000
@@ -21,7 +21,7 @@
     "dependencies": {
         "electron-progressbar": "^1.2.0",
         "jquery": "^3.4.1",
-        "oracledb": "github:oracle/node-oracledb#v3.1.2"
+        "oracledb": "github:oracle/node-oracledb#dev-4.0"
     },
     "devDependencies": {
         "babel-eslint": "^10.0.1",

@tonydiep
Copy link

@victorgianvechio Thanks for advice. Unfortunately I still get the same error after deleting node_modules and reinstalling fresh dependencies and dev-4.0.

@cjbj
Copy link
Member

cjbj commented Jul 16, 2019

@tonydiep do some debugging and see what exactly is being loaded by what.

@victorgianvechio
Copy link
Author

victorgianvechio commented Jul 16, 2019

@cjbj i tried it now and worked without using electron-rebuild, great!!! see package.json

@tonydiep have you deleted package-lock.json before running npm install?

iam using

$ node -v
v10.15.3

$ npm -v
6.4.1

I updated my app with node-oracledb#dev-4.0, test it and see if the error still continues.

 "dependencies": {
        "oracledb": "github:oracle/node-oracledb#dev-4.0"
},
"devDependencies": {  
        "electron": "^5.0.1",
        "electron-rebuild": "^1.8.5"
}

After cloning just run:

npm i 
npm start

@victorgianvechio
Copy link
Author

victorgianvechio commented Jul 16, 2019

@tonydiep be sure if you have node-gyp installed globally

npm i -G node-gyp

iam using [email protected]

$ npm list -g --depth 0
+-- [email protected]

@ceyhunkerti
Copy link

ceyhunkerti commented Oct 16, 2019

Although the solution sucks ...

in
node_modules/oracledb/lib/oracledb.js

locate the line with

oracledbCLib = require(binaryLocations[i]);

and replace it with

oracledbCLib = require('../build/Release/oracledb-4.0.1-linux-x64.node')

oracledb-4.0.1-linux-x64.node this may be different according to your platform and oracledb
module version so check
node_modules/oracledb/build/Release folder first

@Raks25
Copy link

Raks25 commented Apr 8, 2020

I am developing an academic project with electron and oracle. My dbConnection.js file connects to the database and returns a success or error message.

When I run 'node dbConnection.js' the success message appears.

When I try to call the connection method in the electron application I get the following error: Error: NJS-045: Can not load a node-oracledb binary for Node.js 12.0.0 (win32 x64).

Windows 10 x64
Node v10.15.3
Oracle 11G
Phyton 3.7.3
VC Redist 2005/2013/2015/2019 (all these versions installed)

Any ideas how to solve the problem?

@cjbj
Copy link
Member

cjbj commented Apr 8, 2020

@Raks25 this is a closed issue. Search for previous questions on Electron and look at things like electron-rebuild. If you still have problems, please open a new issue.

@ywang67
Copy link

ywang67 commented Apr 8, 2020

Try to use ES module, change the file .js to .mjs, and using require instead of import. It works for me, I think node-oracledb is ESM now.

@pramod9254
Copy link

thanks @cjbj. It worked for me. 👍

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

8 participants