Skip to content

Importing fails in Windows environments without C runtime library #1015

Open
@traeok

Description

  • Operating System Name where ibm_db is installed: Windows 10
  • Target Db2 Server Version or output of db2level command from Db2 database system: N/A
> node -v
20.18.2

> npm ls ibm_db
[email protected] C:\Users\WDAGUtilityAccount\test-proj                                                                   
-- [email protected]

C:\Users\WDAGUtilityAccount\test-proj>echo %IBM_DB_HOME%
%IBM_DB_HOME%

C:\Users\WDAGUtilityAccount\test-proj>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\WDAGUtilityAccount\scoop\apps\nodejs\current\bin;C:\Users\WDAGUtilityAccount\scoop\apps\nodejs\current;C:\Users\WDAGUtilityAccount\scoop\shims;C:\Users\WDAGUtilityAccount\AppData\Local\Microsoft\WindowsApps

C:\Users\WDAGUtilityAccount\test-proj>echo %LIB%
%LIB%

Steps to Reproduce:

In Windows Sandbox or an environment w/o the CRT available:

  1. mkdir test-proj
  2. cd test-proj
  3. npm init -y
  4. npm install ibm_db
  5. node -i
  6. In the REPL, type const ibmDb = await import("ibm_db")
  7. See the error message during import:

Image

These steps work with [email protected] but not with [email protected].

Possible solution:

Bundling the CRT as a static library may resolve this issue - we faced a similar situation in a Zowe node package where a Node-native module could not be found in environments without CRT. Compiling our Node-native binaries with a static C runtime resolved this for our scenario, so I figured it was worth mentioning here.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions