Closed maxkub47 closed 3 months ago
I believe that error is because you're building with node 20, but this package only supports node 18 as per the README.
However, I get a similar error when building with node 18.20.2
:
gyp info using node@18.20.2 | darwin | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/odbc/src/odbc.o
../src/odbc.cpp:228:41: warning: comparison of array 'odbcError.state' not equal to a null pointer is always true [-Wtautological-pointer-compare]
Napi::String::New(env, (odbcError.state != NULL) ? (const char*)odbcError.state : "")
~~~~~~~~~~^~~~~ ~~~~
In file included from ../src/odbc.cpp:22:
In file included from ../src/odbc.h:27:
In file included from /Users/acheronfail/path/to/my/project/node_modules/node-addon-api/napi.h:2725:
/Users/acheronfail/path/to/my/project/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
^~~~~~~~~~~~~~~~~~
/Users/acheronfail/path/to/my/project/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
status = Napi::details::AttachData(env, *result, data);
^
/Users/acheronfail/path/to/my/project/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
napi_status status = CreateFunction(env,
^
../src/odbc.cpp:148:42: note: in instantiation of function template specialization 'Napi::Function::New<Napi::Value (*)(const Napi::CallbackInfo &)>' requested here
exports.Set("connect", Napi::Function::New(env, ODBC::Connect));
^
/Users/acheronfail/Library/Caches/node-gyp/18.20.2/include/node/js_native_api.h:513: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
napi_add_finalizer(napi_env env,
^
1 warning and 1 error generated.
make: *** [Release/obj.target/odbc/src/odbc.o] Error 1
which, according to the README should be supported!
I tried to install both node18,20,22 but I got the same error. I think the download path not found "https://github.com/markdirish/node-odbc/releases/download/v2.4.8/odbc-v2.4.8-darwin-arm64-napi-v6.tar.gz" because I went to look in that path and there are only x64 files, no arm64, but I don't know how to fix it.
It's okay for there not to be prebuilt arm64 assets, as long as the fallback build script can build it locally. This works for me on node 18.18
(on arm, too!) but it doesn't for node 18.20
, so there's an issue there.
I've been poking around the build setup for odbc
, and I noticed if I remove the NAPI_EXPERIMENTAL
defines from binding.gyp
, then the build successfully completes when building for node 18.20
. I have no idea if that breaks anything else, since I don't know how to run the test suite locally (seems it wants an ibmi
database?)...
@acheronfail that's weird. I tried installing with node 18.18.0
, 18.18.2
, 18.17.1
and got the error every time.
mbp ~/Code/sandbox % node -v
v18.18.0
mbp ~/Code/sandbox % npm i odbc
npm WARN skipping integrity check for git dependency ssh://git@github.com/jonschlinkert/is-true.git
npm WARN deprecated npmlog@5.0.1: This package is no longer supported.
npm WARN deprecated are-we-there-yet@2.0.0: This package is no longer supported.
npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated gauge@3.0.2: This package is no longer supported.
npm ERR! code 1
npm ERR! path /Users/kg/Code/sandbox/node_modules/odbc
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute '/Users/kg/.nvm/versions/node/v18.18.0/bin/node /Users/kg/.nvm/versions/node/v18.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/kg/Code/sandbox/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/Users/kg/Code/sandbox/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 node-pre-gyp@1.0.11
npm ERR! node-pre-gyp info using node@18.18.0 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/kg/Code/sandbox/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-darwin-arm64-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-darwin-arm64-napi-v6.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for odbc@2.4.8 and node@18.18.0 (node-v108 ABI, unknown) (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-darwin-arm64-napi-v6.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@18.18.0 | darwin | arm64
...
I'm running into the same issue with node 18.20 as well
Same issue here!
I have the exact same issue unfortunately
When will this fix be released? We can't use the official npm version because of this.
I can install in windowOS but in macOS i found this error