[BUG] Pre-built binaries not installable - Need prebuilt PPC64 linux releases odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz
Describe your system
odbcPackage Version: 2.4.8- ODBC Driver: latest
- Database Name: DB2 for i
- Database OS: IBM i
- Node.js Version: 18.20.2
- Node.js OS: RHEL 9.1 Power Linux 5.14.0-162.6.1.el9_1.ppc64le
Describe the bug
When running npm install on a Power Linux RHEL9 host it can't download pre-built binaries because their are none for linux ppc64. Trying to build it locally is also having issues with
error: invalid conversion from ‘napi_finalize’ {aka ‘void (*)(napi_env__*, void*, void*)’} to ‘node_api_nogc_finalize’ {aka ‘void (*)(const napi_env__*, void*, void*)’} [-fpermissive]
Expected behavior
Expectation was that there would be pre-built binaries for PowerPC Linux and wouldnt need to install gcc, make, g++. The hassles to get sql.h from unixODBC-devel using subscription-manager repos --enable codeready-builder-for-rhel-9-ppcle-rpms https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html-single/package_manifest/index#CodeReadyLinuxBuilder-repository https://access.redhat.com/articles/4348511
To Reproduce Steps to reproduce the behavior:
- On a RHEL9 PPC computer run npm install with node-odbc in the package.json file
Additional context
Here's the error message
npm ERR! code 1
npm ERR! path /home/the_user/the_project/server_side_code/node_modules/odbc
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! make: Entering directory '/home/the_user/the_project/server_side_code/node_modules/odbc/build'
npm ERR! CXX(target) Release/obj.target/odbc/src/odbc.o
npm ERR! make: Leaving directory '/home/the_user/the_project/server_side_code/node_modules/odbc/build'
npm ERR! Failed to execute '/home/the_user/.nvm/versions/node/v18.20.2/bin/node /home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | linux | ppc64
npm ERR! node-pre-gyp info check checked for "/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, glibc) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-linux-ppc64-napi-v6.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | ppc64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | ppc64
npm ERR! gyp info find Python using Python version 3.9.18 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v18.20.2/node-v18.20.2-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.20.2/node-v18.20.2-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v18.20.2/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.20.2/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/the_user/the_project/server_side_code/node_modules/odbc/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/the_user/.cache/node-gyp/18.20.2/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/the_user/.cache/node-gyp/18.20.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/the_user/.cache/node-gyp/18.20.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/the_user/the_project/server_side_code/node_modules/odbc',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | ppc64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi.h:2725,
npm ERR! from ../src/odbc.h:27,
npm ERR! from ../src/odbc.cpp:22:
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h: In instantiation of ‘napi_status Napi::details::AttachData(napi_env, napi_value, FreeType*, napi_finalize, void*) [with FreeType = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_value = napi_value__*; napi_finalize = void (*)(napi_env__*, void*, void*)]’:
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h:1965:39: required from ‘napi_status Napi::CreateFunction(napi_env, const char*, napi_callback, CbData*, napi_value__**) [with CbData = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_callback = napi_value__* (*)(napi_env__*, napi_callback_info__*); napi_value = napi_value__*]’
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h:2021:38: required from ‘static Napi::Function Napi::Function::New(napi_env, Callable, const char*, void*) [with Callable = Napi::Value (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]’
npm ERR! ../src/odbc.cpp:148:45: required from here
npm ERR! /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi-inl.h:63:47: error: invalid conversion from ‘napi_finalize’ {aka ‘void (*)(napi_env__*, void*, void*)’} to ‘node_api_nogc_finalize’ {aka ‘void (*)(const napi_env__*, void*, void*)’} [-fpermissive]
npm ERR! 63 | status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm ERR! | ^~~~~~~~~
npm ERR! | |
npm ERR! | napi_finalize {aka void (*)(napi_env__*, void*, void*)}
npm ERR! In file included from /home/the_user/.cache/node-gyp/18.20.2/include/node/node_api.h:12,
npm ERR! from /home/the_user/the_project/server_side_code/node_modules/node-addon-api/napi.h:4,
npm ERR! from ../src/odbc.h:27,
npm ERR! from ../src/odbc.cpp:22:
npm ERR! /home/the_user/.cache/node-gyp/18.20.2/include/node/js_native_api.h:516:43: note: initializing argument 4 of ‘napi_status napi_add_finalizer(napi_env, napi_value, void*, node_api_nogc_finalize, void*, napi_ref__**)’
npm ERR! 516 | node_api_nogc_finalize finalize_cb,
npm ERR! | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
npm ERR! make: *** [odbc.target.mk:133: Release/obj.target/odbc/src/odbc.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Linux 5.14.0-427.24.1.el9_4.ppc64le
npm ERR! gyp ERR! command "/home/the_user/.nvm/versions/node/v18.20.2/bin/node" "/home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node" "--module_name=odbc" "--module_path=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
npm ERR! gyp ERR! cwd /home/the_user/the_project/server_side_code/node_modules/odbc
npm ERR! gyp ERR! node -v v18.20.2
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/home/the_user/.nvm/versions/node/v18.20.2/bin/node /home/the_user/.nvm/versions/node/v18.20.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/home/the_user/the_project/server_side_code/node_modules/odbc/lib/bindings/napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/the_user/the_project/server_side_code/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:517:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:303:5)
npm ERR! node-pre-gyp ERR! System Linux 5.14.0-427.24.1.el9_4.ppc64le
npm ERR! node-pre-gyp ERR! command "/home/the_user/.nvm/versions/node/v18.20.2/bin/node" "/home/the_user/the_project/server_side_code/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /home/the_user/the_project/server_side_code/node_modules/odbc
npm ERR! node-pre-gyp ERR! node -v v18.20.2
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in: /home/the_user/.npm/_logs/2024-07-28T20_20_44_555Z-debug-0.log
I also get a very similar error on my windows 11 machine. Did you have any luck figuring out the issue?
I can post my error log as well if it helps. It looks very similar to yours though.
@cblair-dev since you are running it from windows I would of expected it to grab the odbc-v2.4.8-win32-x64-napi-v6.tar.gz on this page https://github.com/markdirish/node-odbc/releases
@phpdave thanks for the quick reply. Here is my error report. It appears that it is trying to grab that file, but fails because of not being able to verify the first certificate? Not sure I know what that means.
edit - the code wrap makes the formatting word wrap for some reason, leaving it without for now
124 verbose node v18.20.4
125 verbose npm v10.7.0
126 error code 1
127 error path C:\vuetest2\node_modules\odbc
128 error command failed
129 error command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
130 error Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\user\AppData\Roaming\nvm\v18.20.4\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6\odbc.node --module_name=odbc --module_path=C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
131 error node-pre-gyp info it worked if it ends with ok
131 error node-pre-gyp info using [email protected]
131 error node-pre-gyp info using [email protected] | win32 | x64
131 error node-pre-gyp info check checked for "C:\vuetest2\node_modules\odbc\lib\bindings\napi-v6\odbc.node" (not found)
131 error node-pre-gyp http GET https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-win32-x64-napi-v6.tar.gz
131 error node-pre-gyp ERR! install request to https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-win32-x64-napi-v6.tar.gz failed, reason: unable to verify the first certificate
131 error node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
131 error node-pre-gyp WARN Hit error request to https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-win32-x64-napi-v6.tar.gz failed, reason: unable to verify the first certificate
131 error gyp info it worked if it ends with ok
131 error gyp info using [email protected]
131 error gyp info using [email protected] | win32 | x64
131 error gyp info ok
131 error gyp info it worked if it ends with ok
131 error gyp info using [email protected]
131 error gyp info using [email protected] | win32 | x64
131 error gyp info find Python using Python version 3.11.2 found at "C:\Python311\python.exe"
131 error gyp http GET https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz
131 error gyp http fetch GET https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz attempt 1 failed with UNABLE_TO_VERIFY_LEAF_SIGNATURE
131 error gyp WARN install got an error, rolling back install
131 error gyp ERR! configure error
131 error gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz failed, reason: unable to verify the first certificate
131 error gyp ERR! stack at ClientRequest.
@cblair-dev something is wrong with your setup and is a completely separate problem
failed, reason: unable to verify the first certificate
It tries to download the prebuilt binary, but fails due to HTTPS certificate validation failure. Then it falls back to building it, but that also fails because of HTTP certificate validation failure downloading the nodejs headers.
Do you have a corporate HTTPS proxy of some kind? If so you may need to add its certificate to your CA trust (not sure how to do that on Windows) or disable validation in npm.
@kadler this is what I am reading as well when researching this issue.
I am currently in talks with our IT department to see if they are aware of what would be causing it.
@phpdave the current pre-built binaries rely on GitHub Actions to build, which does not support Power. We would need to find another CI vendor that has support for Power or figure out a way to cross-compile from the x86 Linux runner provided by GH.
@kadler, the one thing that is making me confused more than anything is that if I just remove odbc from my package.json, delete my node_modules, and rebuild it, I have zero issues.
If it is a certificate issue, wouldn't I get a similar error with all of the libraries I try to download?
FWIW - might be a strict typing issue in c++ with the changes made in node.js core forcing a strict type node_api_nogc_finalize now and complaining about using the non garbage collection type napi_finalize. Something that seems to have been done around 18.20.2 to 18.20.3
Might be related in node/src/js_native_api_types.h in core https://github.com/nodejs/node/blame/d1229eeca48ef349a8a9fc0748bc01789bdbce91/src/js_native_api_types.h#L154
or node-addon-api https://github.com/nodejs/node-addon-api/commit/40bcb09e6b82e7a1164cb3de56cb503d9b5a3d37
but im not really versed in node.js internals or c++ (been awhile)
I get the same issue on my Apple M1 macbook:
npm error node-pre-gyp info using [email protected]
npm error node-pre-gyp info using [email protected] | darwin | arm64
npm error node-pre-gyp info check checked for "/Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/odbc/lib/bindings/napi-v6/odbc.node" (not found)
npm error node-pre-gyp http GET https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-darwin-arm64-napi-v6.tar.gz
npm error node-pre-gyp ERR! install response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-darwin-arm64-napi-v6.tar.gz
npm error node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v115 ABI, unknown) (falling back to source compile with node-gyp)
npm error node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-darwin-arm64-napi-v6.tar.gz
...
The build with node-gyp also fails:
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error ../src/odbc.cpp:228:41: warning: comparison of array 'odbcError.state' not equal to a null pointer is always true [-Wtautological-pointer-compare]
npm error Napi::String::New(env, (odbcError.state != NULL) ? (const char*)odbcError.state : "")
npm error ~~~~~~~~~~^~~~~ ~~~~
npm error In file included from ../src/odbc.cpp:22:
npm error In file included from ../src/odbc.h:27:
npm error In file included from /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi.h:2725:
npm error /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
npm error status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm error ^~~~~~~~~~~~~~~~~~
npm error /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm error status = Napi::details::AttachData(env, *result, data);
npm error ^
npm error /Users/mielvandersande/Meemoo/Development/prefect-flows/prefect-flow-object-etl/triplyetl/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm error napi_status status = CreateFunction(env,
npm error ^
npm error ../src/odbc.cpp:148:42: note: in instantiation of function template specialization 'Napi::Function::New<Napi::Value (*)(const Napi::CallbackInfo &)>' requested here
npm error exports.Set("connect", Napi::Function::New(env, ODBC::Connect));
npm error ^
npm error /Users/mielvandersande/Library/Caches/node-gyp/20.16.0/include/node/js_native_api.h:520:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_nogc_finalize' (aka 'void (*)(const napi_env__ *, void *, void *)') for 4th argument
npm error napi_add_finalizer(napi_env env,
npm error ^
npm error 1 warning and 1 error generated.
npm error make: *** [Release/obj.target/odbc/src/odbc.o] Error 1
npm error gyp ERR! build error
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/Users/mielvandersande/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Darwin 23.5.0
...
The node-gyp build does work with node version 21.5.0, so that seems to be another unrelated issue. See https://github.com/node-ffi-napi/node-ffi-napi/issues/267
Note this issue also occurs on
OS: Linux 5.14.0-427.26.1.el9_4.ppc64le node: v20.16.0 (July 24, 2024) node-gyp: v10.1.0 (Mar 25, 2024)
> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h: In instantiation of ‘napi_status Napi::details::AttachData(napi_env, napi_value, FreeType*, napi_finalize, void*) [with FreeType = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_value = napi_value__*; napi_finalize = void (*)(napi_env__*, void*, void*)]’:
> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h:1965:39: required from ‘napi_status Napi::CreateFunction(napi_env, const char*, napi_callback, CbData*, napi_value__**) [with CbData = Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo&), Napi::Value>; napi_env = napi_env__*; napi_callback = napi_value__* (*)(napi_env__*, napi_callback_info__*); napi_value = napi_value__*]’
> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h:2021:38: required from ‘static Napi::Function Napi::Function::New(napi_env, Callable, const char*, void*) [with Callable = Napi::Value (*)(const Napi::CallbackInfo&); napi_env = napi_env__*]’
> 1737 error ../src/odbc.cpp:148:45: required from here
> 1737 error /www/the_project/server/node_modules/node-addon-api/napi-inl.h:63:47: error: invalid conversion from ‘napi_finalize’ {aka ‘void (*)(napi_env__*, void*, void*)’} to ‘node_api_nogc_finalize’ {aka ‘void (*)(const napi_env__*, void*, void*)’} [-fpermissive]
> 1737 error 63 | status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
> 1737 error | ^~~~~~~~~
> 1737 error | |
> 1737 error | napi_finalize {aka void (*)(napi_env__*, void*, void*)}
> 1737 error In file included from /home/the_user/.cache/node-gyp/20.16.0/include/node/node_api.h:12,
> 1737 error from /www/the_project/server/node_modules/node-addon-api/napi.h:4,
> 1737 error from ../src/odbc.h:27,
> 1737 error from ../src/odbc.cpp:22:
> 1737 error /home/the_user/.cache/node-gyp/20.16.0/include/node/js_native_api.h:523:43: note: initializing argument 4 of ‘napi_status napi_add_finalizer(napi_env, napi_value, void*, node_api_nogc_finalize, void*, napi_ref__**)’
> 1737 error 523 | node_api_nogc_finalize finalize_cb,
> 1737 error | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> 1737 error make: *** [odbc.target.mk:128: Release/obj.target/odbc/src/odbc.o] Error 1
> 1737 error gyp ERR! build error
> 1737 error gyp ERR! stack Error: `make` failed with exit code: 2
> 1737 error gyp ERR! stack at ChildProcess.<anonymous> (/home/the_user/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
> 1737 error gyp ERR! System Linux 5.14.0-427.26.1.el9_4.ppc64le
> 1737 error gyp ERR! command "/home/the_user/.nvm/versions/node/v20.16.0/bin/node" "/home/the_user/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6/odbc.node" "--module_name=odbc" "--module_path=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
> 1737 error gyp ERR! cwd /www/the_project/server/node_modules/odbc
> 1737 error gyp ERR! node -v v20.16.0
> 1737 error gyp ERR! node-gyp -v v10.1.0
> 1737 error gyp ERR! not ok
> 1737 error node-pre-gyp ERR! build error
> 1737 error node-pre-gyp ERR! stack Error: Failed to execute '/home/the_user/.nvm/versions/node/v20.16.0/bin/node /home/the_user/.nvm/versions/node/v20.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/www/the_project/server/node_modules/odbc/lib/bindings/napi-v6 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
> 1737 error node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/www/the_project/server/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
> 1737 error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:519:28)
> 1737 error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16)
> 1737 error node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5)
> 1737 error node-pre-gyp ERR! System Linux 5.14.0-427.26.1.el9_4.ppc64le
> 1737 error node-pre-gyp ERR! command "/home/the_user/.nvm/versions/node/v20.16.0/bin/node" "/www/the_project/server/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
> 1737 error node-pre-gyp ERR! cwd /www/the_project/server/node_modules/odbc
> 1737 error node-pre-gyp ERR! node -v v20.16.0
> 1737 error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
> 1737 error node-pre-gyp ERR! not ok
@mielvds - Glad to hear you got it working on node 21.5.0 (CPU: darwin-arm64) , do you know what version of node-gyp you were using?
Note this issue doesn't occur on
OS: Linux 5.14.0-427.26.1.el9_4.ppc64le node: v22.6.0 (Aug 6, 2024)
I think this is a bug in node-addon-api. Looks like it was potentially fixed here: https://github.com/nodejs/node-addon-api/commit/40bcb09e6b82e7a1164cb3de56cb503d9b5a3d37#diff-cd0b229bcaf532206661e2ee1a603a7f60ac22ecfcb239920f6b42a34d909f34L68
This would likely also be fixed by the change made to remove NAPI_EXPERIMENTAL in #381, but a new release has not yet been released. Next week we'll be cleaning up some things and get a new npm release made.
Just confirmed that yes, prior to #381 the build files, while after it now succeeds.
Thank you much @kadler ! you rock!
We've released version 2.4.9 which includes the NAPI_EXPERIMENTAL fix: https://www.npmjs.com/package/odbc/v/2.4.9
Hello!
I am running into a similar issue with odbc v2.4.9. I'm building a multi-platform image. This build works for linux/amd64, but not with linux/ppc64le. Do you think this is related or something completely different?
This is the relevant portion of the build command:
docker buildx build --no-cache --platform linux/amd64,linux/ppc64le
Here's my dockerfile:
ARG NODE_VERSION=22
FROM node:${NODE_VERSION}
ENV NODE_ENV=production
ENV TZ=America/Chicago
WORKDIR /usr/src/app
RUN npm install -g nodemon
# Install IBM ODBC drivers
# https://ibmi-oss-docs.readthedocs.io/en/latest/odbc/installation.html#linux
RUN curl https://public.dhe.ibm.com/software/ibmi/products/odbc/debs/dists/1.1.0/ibmi-acs-1.1.0.list | tee /etc/apt/sources.list.d/ibmi-acs-1.1.0.list \
&& apt update \
&& apt install ibm-iaccess=1.1.0.28-1.0 -y
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci --include=dev
COPY . .
RUN npm run build
RUN chown -R node /usr/src/app
USER node
EXPOSE 3000
CMD ["npm", "run", "start-from-container"]
My package.json includes these dependencies:
"dependencies": {
"dotenv": "8.2.0",
"express": "4.16.3",
"generic-pool": "3.9.0",
"odbc": "2.4.9",
"winston": "3.17.0",
"winston-daily-rotate-file": "4.7.1"
},
Here is the error:
7.386 npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
7.448 npm warn deprecated [email protected]: This package is no longer supported.
7.593 npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
7.677 npm warn deprecated [email protected]: This package is no longer supported.
7.705 npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
8.089 npm warn deprecated [email protected]: This package is no longer supported.
30.43 npm error code 1
30.43 npm error path /usr/src/app/node_modules/odbc
30.44 npm error command failed
30.44 npm error command sh -c node-pre-gyp install --fallback-to-build
30.44 npm error make: Entering directory '/usr/src/app/node_modules/odbc/build'
30.44 npm error CXX(target) Release/obj.target/odbc/src/odbc.o
30.44 npm error make: Leaving directory '/usr/src/app/node_modules/odbc/build'
30.44 npm error Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/src/app/node_modules/odbc/lib/bindings/napi-v8/odbc.node --module_name=odbc --module_path=/usr/src/app/node_modules/odbc/lib/bindings/napi-v8 --napi_version=10 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (1)
30.44 npm error node-pre-gyp info it worked if it ends with ok
30.44 npm error node-pre-gyp info using [email protected]
30.44 npm error node-pre-gyp info using [email protected] | linux | ppc64
30.44 npm error node-pre-gyp info check checked for "/usr/src/app/node_modules/odbc/lib/bindings/napi-v8/odbc.node" (not found)
30.44 npm error node-pre-gyp http GET https://github.com/IBM/node-odbc/releases/download/v2.4.9/odbc-v2.4.9-linux-ppc64-napi-v8.tar.gz
30.44 npm error node-pre-gyp ERR! install response status 404 Not Found on https://github.com/IBM/node-odbc/releases/download/v2.4.9/odbc-v2.4.9-linux-ppc64-napi-v8.tar.gz
30.44 npm error node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v127 ABI, glibc) (falling back to source compile with node-gyp)
30.44 npm error node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/IBM/node-odbc/releases/download/v2.4.9/odbc-v2.4.9-linux-ppc64-napi-v8.tar.gz
30.44 npm error gyp info it worked if it ends with ok
30.44 npm error gyp info using [email protected]
30.44 npm error gyp info using [email protected] | linux | ppc64
30.44 npm error gyp info ok
30.44 npm error gyp info it worked if it ends with ok
30.44 npm error gyp info using [email protected]
30.44 npm error gyp info using [email protected] | linux | ppc64
30.44 npm error gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
30.44 npm error gyp http GET https://nodejs.org/download/release/v22.21.1/node-v22.21.1-headers.tar.gz
30.44 npm error gyp http 200 https://nodejs.org/download/release/v22.21.1/node-v22.21.1-headers.tar.gz
30.44 npm error gyp http GET https://nodejs.org/download/release/v22.21.1/SHASUMS256.txt
30.44 npm error gyp http 200 https://nodejs.org/download/release/v22.21.1/SHASUMS256.txt
30.44 npm error gyp info spawn /usr/bin/python3
30.44 npm error gyp info spawn args [
30.44 npm error gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
30.44 npm error gyp info spawn args 'binding.gyp',
30.44 npm error gyp info spawn args '-f',
30.44 npm error gyp info spawn args 'make',
30.44 npm error gyp info spawn args '-I',
30.44 npm error gyp info spawn args '/usr/src/app/node_modules/odbc/build/config.gypi',
30.44 npm error gyp info spawn args '-I',
30.44 npm error gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
30.44 npm error gyp info spawn args '-I',
30.44 npm error gyp info spawn args '/root/.cache/node-gyp/22.21.1/include/node/common.gypi',
30.44 npm error gyp info spawn args '-Dlibrary=shared_library',
30.44 npm error gyp info spawn args '-Dvisibility=default',
30.44 npm error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/22.21.1',
30.44 npm error gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
30.44 npm error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/22.21.1/<(target_arch)/node.lib',
30.44 npm error gyp info spawn args '-Dmodule_root_dir=/usr/src/app/node_modules/odbc',
30.44 npm error gyp info spawn args '-Dnode_engine=v8',
30.44 npm error gyp info spawn args '--depth=.',
30.44 npm error gyp info spawn args '--no-parallel',
30.44 npm error gyp info spawn args '--generator-output',
30.44 npm error gyp info spawn args 'build',
30.44 npm error gyp info spawn args '-Goutput_dir=.'
30.44 npm error gyp info spawn args ]
30.44 npm error gyp info ok
30.44 npm error gyp info it worked if it ends with ok
30.44 npm error gyp info using [email protected]
30.44 npm error gyp info using [email protected] | linux | ppc64
30.44 npm error gyp info spawn make
30.44 npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
30.44 npm error In file included from ../src/odbc.cpp:22:
30.44 npm error ../src/odbc.h:37:10: fatal error: sql.h: No such file or directory
30.44 npm error 37 | #include <sql.h>
30.44 npm error | ^~~~~~~
30.44 npm error compilation terminated.
30.44 npm error make: *** [odbc.target.mk:128: Release/obj.target/odbc/src/odbc.o] Error 1
30.44 npm error gyp ERR! build error
30.44 npm error gyp ERR! stack Error: `make` failed with exit code: 2
30.44 npm error gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:219:23)
30.44 npm error gyp ERR! System Linux 6.6.87.2-microsoft-standard-WSL2
30.44 npm error gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/src/app/node_modules/odbc/lib/bindings/napi-v8/odbc.node" "--module_name=odbc" "--module_path=/usr/src/app/node_modules/odbc/lib/bindings/napi-v8" "--napi_version=10" "--node_abi_napi=napi" "--napi_build_version=8" "--node_napi_label=napi-v8"
30.44 npm error gyp ERR! cwd /usr/src/app/node_modules/odbc
30.44 npm error gyp ERR! node -v v22.21.1
30.44 npm error gyp ERR! node-gyp -v v11.2.0
30.44 npm error gyp ERR! not ok
30.44 npm error node-pre-gyp ERR! build error
30.44 npm error node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/src/app/node_modules/odbc/lib/bindings/napi-v8/odbc.node --module_name=odbc --module_path=/usr/src/app/node_modules/odbc/lib/bindings/napi-v8 --napi_version=10 --node_abi_napi=napi --napi_build_version=8 --node_napi_label=napi-v8' (1)
30.44 npm error node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/src/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
30.44 npm error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:519:28)
30.44 npm error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1101:16)
30.44 npm error node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:304:5)
30.44 npm error node-pre-gyp ERR! System Linux 6.6.87.2-microsoft-standard-WSL2
30.44 npm error node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/src/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
30.44 npm error node-pre-gyp ERR! cwd /usr/src/app/node_modules/odbc
30.44 npm error node-pre-gyp ERR! node -v v22.21.1
30.44 npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
30.44 npm error node-pre-gyp ERR! not ok
30.45 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-11-13T17_09_34_871Z-debug-0.log
------
Dockerfile:30
--------------------
29 | # into this layer.
30 | >>> RUN --mount=type=bind,source=package.json,target=package.json \
31 | >>> --mount=type=bind,source=package-lock.json,target=package-lock.json \
32 | >>> --mount=type=cache,target=/root/.npm \
33 | >>> npm ci --include=dev
34 |
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c npm ci --include=dev" did not complete successfully: exit code: 1
30.44 npm error ../src/odbc.h:37:10: fatal error: sql.h: No such file or directory
30.44 npm error 37 | #include <sql.h>
30.44 npm error | ^~~~~~~
You do not have the unixodbc devel package installed. See https://github.com/IBM/node-odbc?tab=readme-ov-file#requirements
Thank you @kadler , that was the issue in my case. I should have looked at that documentation more closely.