node-oracledb icon indicating copy to clipboard operation
node-oracledb copied to clipboard

Error: NJS-045: cannot load the oracle-db add-on binary

Open TikiLobel opened this issue 8 years ago • 11 comments

  • Node.js version: 8.11.1
  • 64-bit computer
  • node-oracledb version: 2.0.15
  • Instant Client version: 1.0.1 ( I think 12_2 but I cannot check...) I used npm install instantclient to install, and i did it within the folder that my project resides (I opened a terminal from the folder in Visual Studio)
  • I set the path variable through the Control Panel: C:\users\tlobel\source\repos\Attempt1\Attempt1\node_modules\instantclient;C:\Users\tlobel\Downloads\VC_redist.x64;C:\Python27;C:\Python27\Scripts;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Users\tlobel\AppData\Roaming\npm;

(In the path, I am unsure about whether to include 'node_modules' to instant client, since I see there is also once outside of the folder, which includes most of the contents - inside node_modules the instant client folder only has instantclient.js and a few other things)

When I try and run my code, which consists of:

const oracledb = require('oracledb')

I get the error:

_**Error: NJS-045: cannot load the oracledb add-on binary for Node.js 8.11.1 (win32, x64) Cannot load C:\Users\tlobel\source\repos\Attempt1\Attempt1\node_modules\oracledb\build\Release\oracledb.node DPI-1050: Oracle Client library must be at version 11.2 or higher 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.

at Object.<anonymous> (C:\Users\tlobel\source\repos\Attempt1\Attempt1\node_modules\oracledb\lib\oracledb.js:68:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\tlobel\source\repos\Attempt1\Attempt1\node_modules\oracledb\index.js:1:80)
at Module._compile (module.js:652:30)**_

My project set up looks like this:

project

TikiLobel avatar Apr 24 '18 13:04 TikiLobel

@bchr02, this is your npm Instant Client package. Can you take a look?

@TikiLobel Don't forget to install the VC Redistibutables. And restart any terminal window after changing PATH. Personally I'd follow the instructions here https://oracle.github.io/node-oracledb/INSTALL.html#instwin and use the Instant Client ZIP files.

cjbj avatar Apr 24 '18 22:04 cjbj

Just add the following lines to your app in the order provided:

var path = require('path'); process.env['PATH'] = path.join(__dirname, '/instantclient') + ';' + process.env['PATH']; var oracledb = require('oracledb');

bchr02 avatar Apr 24 '18 23:04 bchr02

@cjbj I checked and I have instantclient 12.1.0.2.0, so i downloaded the 2010 redistributable and it still does not work (still working on Visual Studio 2017, and instantclient has value '^1.0.1' in package.json

TikiLobel avatar Apr 26 '18 08:04 TikiLobel

With all methods I get the same error:

_**Error: NJS-045: cannot load the oracledb add-on binary for Node.js 8.11.1 (win32, x64) Cannot load C:\Users\tlobel\source\repos\Attempt1\Attempt1\node_modules\oracledb\build\Release\oracledb.node DPI-1050: Oracle Client library must be at version 11.2 or higher 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.

at Object. (C:\Users\tlobel\sourc

My paths are set correctly and installation of oracledb is successful but when I run the code this error happens...Any other solutions?

TikiLobel avatar Apr 30 '18 14:04 TikiLobel

My paths are set correctly

From the errors, the PATH is not set OK.

I haven't looked at @bchr02's package; maybe there's something I don't know.

cjbj avatar May 01 '18 01:05 cjbj

I'll try and organize what I have currently:

I have a User-variable in environment variables:

PATH=C:\provisioning\instantclient;C:\Users\tlobel\Downloads\VC_redist.x64.exe;

and a System Variable:

PATH=%SystemRoot%\system32\WindowsPowerShell\v1.0;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\tlobel\Downloads\VC_redist.x64.exe;C:\provisioning\instantclient;

and my NODE_PATH is unset for the time being. I have a 64-bit computer Node version 8.11.1 (Update: I downgraded to 6.11.0 since commands seem to work better with that version) npm version 6.0.0 node-oracledb version 2.2

My folder structure looks like this:

folders

The location of the oracledb.node that it is not managing to load is:

node-folder

I have downloaded the 2010 Redistributable for VS since I have the instant client version 12.1, and that is the file 'VC_redist.x64.exe' in my paths. (Not located in same folder as project, rather in Downloads folder)

The code fails and gives the error above at the line:

const oracledb = require("oracledb");

Any other information I can provide? Thank you for your responses, I really appreciate your time...

TikiLobel avatar May 01 '18 05:05 TikiLobel

@TikiLobel I'm circling back on this after being away, what's the status?

cjbj avatar May 16 '18 04:05 cjbj

@cjbj It seems to have been a problem with the operating system itself, since I tried your instructions on another computer and it worked without a problem - Thanks for your help!

TikiLobel avatar May 21 '18 05:05 TikiLobel

@TikiLobel I'll close this then. Thanks for the update.

cjbj avatar May 22 '18 09:05 cjbj

@TikiLobel did you resolve the oraceldb connecting issue.

throw new Error(nodbUtil.getErrorMessage('NJS-045', nodeInfo)); ^

Error: NJS-045: cannot load the oracledb add-on binary for Node.js 8.11.2 (win32, x64)Node.js require() error was: DPI-1047: 64-bit Oracle Client library cannot be loaded: "C:\oracle\instantclient_12_2\oci.dll is not the correct architecture". See https://oracle.github.io/odpi/doc/installation.html#windows for help Node.js require() mapped to D:\oracle\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.<anonymous> (D:\oracle\node_modules\oracledb\lib\oracledb.js:65:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\oracle\node_modules\oracledb\index.js:1:80)
at Module._compile (module.js:652:30)

sudheer160540 avatar Aug 08 '18 05:08 sudheer160540

@sudheer160540 (i) read the error message carefully (ii) open a new issue if you still have problems.

cjbj avatar Aug 08 '18 06:08 cjbj