Pessi S.
Pessi S.

Reputation: 93

Using Oracle DB Thick Mode with Node 22: "NJS-045: cannot load a node-oracledb Thick mode binary" error

I'm attempting to upgrade my Node.js application to Node 22, but I'm encountering issues with connecting to Oracle DB using node-oracledb in Thick Mode. The same configuration works without issues in Node 20, but with Node 22, I receive the following error:

NJS-045: cannot load a node-oracledb Thick mode binary for Node.js. Please try using Thin mode.
Looked for D:\...\my-project\node_modules\oracledb\build\Release\oracledb-6.6.0-win32-ia32.node, ...

Environment:

Code Snippet:

Here's the relevant portion of the code where I initialize the Oracle client:

const oracledb = require('oracledb');
const knex = require('knex');

const libDir = "C:\\oracle\\instantclient_basic_windows_x64_23_5_0_24_07\\instantclient_23_5";
oracledb.initOracleClient({ libDir });

const client = knex({
    client: 'oracledb',
    connection: {
        user: config.oracle.user,
        password: config.oracle.password,
        connectString: config.oracle.connectionString
    },
    pool: {
        min: config.connectionPool.min,
        max: config.connectionPool.max,
        idleTimeoutMillis: config.connectionPool.idleTimeout
    },
    acquireConnectionTimeout: config.connectionPool.acquireConnectionTimeout
});

const result = await client.raw('SELECT 1 FROM DUAL');

Error Details

With Node 22, I get the following error:

Error: NJS-045: cannot load a node-oracledb Thick mode binary for Node.js. Please try using Thin mode.
Looked for D:\...\my-project\node_modules\oracledb\build\Release\oracledb-6.6.0-win32-ia32.node, ...

Steps Tried

Questions

  1. Is there a specific Instant Client version requirement for using node-oracledb in Thick Mode with Node 22?
  2. Are there additional configurations needed in Node 22 to support Oracle DB Thick Mode?
  3. How can I troubleshoot further to identify the root cause of the Thick Mode binary loading failure?

Any insights or suggestions would be greatly appreciated!

Upvotes: 1

Views: 269

Answers (1)

Christopher Jones
Christopher Jones

Reputation: 10721

Use the attribute name in the parameter:

const libDir = "C:\\oracle\\instantclient_basic_windows_x64_23_5_0_24_07\\instantclient_23_5";
oracledb.initOracleClient({ libDir: libDir });

Upvotes: 0

Related Questions