Open phpdave opened 3 months ago
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 node-pre-gyp@1.0.11
131 error node-pre-gyp info using node@18.20.4 | 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 odbc@2.4.8 and node@18.20.4 (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 node-gyp@10.1.0
131 error gyp info using node@18.20.4 | win32 | x64
131 error gyp info ok
131 error gyp info it worked if it ends with ok
131 error gyp info using node-gyp@10.1.0
131 error gyp info using node@18.20.4 | 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 node-pre-gyp@1.0.11
npm error node-pre-gyp info using node@20.16.0 | 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 odbc@2.4.8 and node@20.16.0 (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
Describe your system
odbc
Package Version: 2.4.8Describe 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 withExpected 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/4348511To Reproduce Steps to reproduce the behavior:
Additional context
Here's the error message