wankdanker / node-odbc

ODBC bindings for node
MIT License
175 stars 80 forks source link

odbc installation fails on Apple Silicon M3 Max #94

Closed Relbot closed 1 day ago

Relbot commented 3 months ago

I have a new laptop installed unixODBC but couldn't get it to work with node-odbc. I get the following error.

npm error code 1 npm error path /Users//Documents/App/name/nameBackend/node_modules/odbc npm error command failed npm error command sh -c node-pre-gyp install --fallback-to-build npm error CXX(target) Release/obj.target/odbc/src/odbc.o 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=/Users//Documents/App/name/nameBackend/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/Users//Documents/App/name/nameBackend/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 error node-pre-gyp info it worked if it ends with ok npm error node-pre-gyp info using node-pre-gyp@1.0.11 npm error node-pre-gyp info using node@20.15.1 | darwin | arm64 npm error node-pre-gyp info check checked for "/Users//Documents/App/name/nameBackend/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.15.1 (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 npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@10.1.0 npm error gyp info using node@20.15.1 | darwin | arm64 npm error gyp info ok npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@10.1.0 npm error gyp info using node@20.15.1 | darwin | arm64 npm error gyp info find Python using Python version 3.12.4 found at "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3" npm error gyp info spawn /Library/Frameworks/Python.framework/Versions/3.12/bin/python3 npm error gyp info spawn args [ npm error gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', npm error gyp info spawn args 'binding.gyp', npm error gyp info spawn args '-f', npm error gyp info spawn args 'make', npm error gyp info spawn args '-I', npm error gyp info spawn args '/Users//Documents/App/name/nameBackend/node_modules/odbc/build/config.gypi', npm error gyp info spawn args '-I', npm error gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm error gyp info spawn args '-I', npm error gyp info spawn args '/Users//Library/Caches/node-gyp/20.15.1/include/node/common.gypi', npm error gyp info spawn args '-Dlibrary=shared_library', npm error gyp info spawn args '-Dvisibility=default', npm error gyp info spawn args '-Dnode_root_dir=/Users//Library/Caches/node-gyp/20.15.1', npm error gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp', npm error gyp info spawn args '-Dnode_lib_file=/Users//Library/Caches/node-gyp/20.15.1/<(target_arch)/node.lib', npm error gyp info spawn args '-Dmodule_root_dir=/Users//Documents/App/name/nameBackend/node_modules/odbc', npm error gyp info spawn args '-Dnode_engine=v8', npm error gyp info spawn args '--depth=.', npm error gyp info spawn args '--no-parallel', npm error gyp info spawn args '--generator-output', npm error gyp info spawn args 'build', npm error gyp info spawn args '-Goutput_dir=.' npm error gyp info spawn args ] npm error gyp info ok npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@10.1.0 npm error gyp info using node@20.15.1 | darwin | arm64 npm error gyp info spawn make 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//Documents/App/name/nameBackend/node_modules/node-addon-api/napi.h:2725: npm error /Users//Documents/App/name/nameBackend/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//Documents/App/name/nameBackend/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//Documents/App/name/nameBackend/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//Library/Caches/node-gyp/20.15.1/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. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23) npm error gyp ERR! System Darwin 23.3.0 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=/Users//Documents/App/name/nameBackend/node_modules/odbc/lib/bindings/napi-v6/odbc.node" "--module_name=odbc" "--module_path=/Users//Documents/App/name/nameBackend/node_modules/odbc/lib/bindings/napi-v6" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" npm error gyp ERR! cwd /Users//Documents/App/name/nameBackend/node_modules/odbc npm error gyp ERR! node -v v20.15.1 npm error gyp ERR! node-gyp -v v10.1.0 npm error gyp ERR! not ok npm error node-pre-gyp ERR! build error 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=/Users//Documents/App/name/nameBackend/node_modules/odbc/lib/bindings/napi-v6/odbc.node --module_name=odbc --module_path=/Users//Documents/App/name/nameBackend/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 error node-pre-gyp ERR! stack at ChildProcess. (/Users//Documents/App/name/nameBackend/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23) npm error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:519:28) npm error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1105:16) npm error node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) npm error node-pre-gyp ERR! System Darwin 23.3.0 npm error node-pre-gyp ERR! command "/usr/local/bin/node" "/Users//Documents/App/name/nameBackend/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" npm error node-pre-gyp ERR! cwd /Users//Documents/App/name/nameBackend/node_modules/odbc npm error node-pre-gyp ERR! node -v v20.15.1 npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11 npm error node-pre-gyp ERR! not ok npm error A complete log of this run can be found in: /Users//.npm/_logs/2024-07-20T17_31_35_417Z-debug-0.log

yamadapc commented 2 months ago

Caused by https://github.com/nodejs/node/pull/50060

This breaks from version 18.20.0 onwards, and all versions that include that change.

To fix this, odbc must

Relbot commented 1 day ago

fixed with installing

"odbc": "github:markdirish/node-odbc",