Closed sahuidhsu closed 7 months ago
When I try npm install bluetooth-hci-socket
, below error shown. I'm guessing this package is no longer supported by the latest nodejs?
homebridge@xxx:/var/lib/homebridge $ npm install bluetooth-hci-socket
npm ERR! code 1
npm ERR! path /var/lib/homebridge/node_modules/bluetooth-hci-socket
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Enter dir “/var/lib/homebridge/node_modules/bluetooth-hci-socket/build”
npm ERR! CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
npm ERR! make: Leaving dir “/var/lib/homebridge/node_modules/bluetooth-hci-socket/build”
npm ERR! In file included from ../src/BluetoothHciSocket.cpp:8:
npm ERR! ../node_modules/nan/nan.h: In function ‘bool Nan::IdleNotification(int)’:
npm ERR! ../node_modules/nan/nan.h:689:32: warning: ‘bool v8::Isolate::IdleNotificationDeadline(double)’ is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
npm ERR! 689 | idle_time_in_ms * 0.001);
npm ERR! | ^
npm ERR! In file included from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-initialization.h:13,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8.h:34,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:73,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node_buffer.h:25,
npm ERR! from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-isolate.h:1293:8: note: declared here
npm ERR! 1293 | bool IdleNotificationDeadline(double deadline_in_seconds);
npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static void BluetoothHciSocket::Init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’:
npm ERR! ../src/BluetoothHciSocket.cpp:128:82: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
npm ERR! 128 | target->Set(Nan::New("BluetoothHciSocket").ToLocalChecked(), tmpl->GetFunction());
npm ERR! | ^
npm ERR! In file included from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-function.h:15,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8.h:33,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:73,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node_buffer.h:25,
npm ERR! from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-template.h:497:46: note: candidate: ‘v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)’
npm ERR! 497 | V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
npm ERR! | ^~~~~~~~~~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-template.h:497:46: note: candidate expects 1 argument, 0 provided
npm ERR! ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’:
npm ERR! ../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR! 251 | Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
npm ERR! | ^
npm ERR! In file included from ../src/BluetoothHciSocket.cpp:8:
npm ERR! ../node_modules/nan/nan.h:1053:46: note: declared here
npm ERR! 1053 | NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR! | ^~~~~~~~~~~~
npm ERR! ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError()’:
npm ERR! ../src/BluetoothHciSocket.cpp:269:109: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>)’
npm ERR! 269 | Local<Function> errorConstructor = Local<Function>::Cast(globalObj->Get(Nan::New("Error").ToLocalChecked()));
npm ERR! | ^
npm ERR! In file included from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-array-buffer.h:13,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8.h:24,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:73,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node_buffer.h:25,
npm ERR! from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-object.h:292:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
npm ERR! 292 | V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! | ^~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-object.h:292:43: note: candidate expects 2 arguments, 1 provided
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-object.h:295:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
npm ERR! 295 | V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! | ^~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-object.h:295:43: note: candidate expects 2 arguments, 1 provided
npm ERR! ../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local<v8::Value> [1])’
npm ERR! 275 | Local<Value> error = errorConstructor->NewInstance(1, constructorArgs);
npm ERR! | ^
npm ERR! In file included from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8.h:33,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:73,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node_buffer.h:25,
npm ERR! from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-function.h:38:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const’
npm ERR! 38 | V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
npm ERR! | ^~~~~~~~~~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-function.h:38:44: note: candidate expects 3 arguments, 2 provided
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-function.h:41:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const’
npm ERR! 41 | V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
npm ERR! | ^~~~~~~~~~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-function.h:41:44: note: candidate expects 1 argument, 2 provided
npm ERR! ../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR! 282 | Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
npm ERR! | ^
npm ERR! In file included from ../src/BluetoothHciSocket.cpp:8:
npm ERR! ../node_modules/nan/nan.h:1053:46: note: declared here
npm ERR! 1053 | NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR! | ^~~~~~~~~~~~
npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindRaw(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../src/BluetoothHciSocket.cpp:395:34: error: no matching function for call to ‘v8::Value::IntegerValue()’
npm ERR! 395 | devId = arg0->IntegerValue();
npm ERR! | ^
npm ERR! In file included from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-primitive.h:11,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-object.h:11,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-array-buffer.h:13,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8.h:24,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:73,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node_buffer.h:25,
npm ERR! from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-value.h:423:40: note: candidate: ‘v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const’
npm ERR! 423 | V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR! | ^~~~~~~~~~~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-value.h:423:40: note: candidate expects 1 argument, 0 provided
npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindUser(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../src/BluetoothHciSocket.cpp:417:34: error: no matching function for call to ‘v8::Value::IntegerValue()’
npm ERR! 417 | devId = arg0->IntegerValue();
npm ERR! | ^
npm ERR! In file included from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-primitive.h:11,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-object.h:11,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-array-buffer.h:13,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8.h:24,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:73,
npm ERR! from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node_buffer.h:25,
npm ERR! from ../src/BluetoothHciSocket.cpp:7:
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-value.h:423:40: note: candidate: ‘v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const’
npm ERR! 423 | V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR! | ^~~~~~~~~~~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/v8-value.h:423:40: note: candidate expects 1 argument, 0 provided
npm ERR! In file included from /home/homebridge/.cache/node-gyp/20.10.0/include/node/node_buffer.h:25,
npm ERR! from ../src/BluetoothHciSocket.cpp:7:
npm ERR! ../src/BluetoothHciSocket.cpp: At global scope:
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:1172:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR! 1172 | (node::addon_register_func) (regfunc), \
npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/homebridge/.cache/node-gyp/20.10.0/include/node/node.h:1206:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR! 1206 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
npm ERR! | ^~~~~~~~~~~~~
npm ERR! ../src/BluetoothHciSocket.cpp:499:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR! 499 | NODE_MODULE(binding, BluetoothHciSocket::Init);
npm ERR! | ^~~~~~~~~~~
npm ERR! make: *** [binding.target.mk:111:Release/obj.target/binding/src/BluetoothHciSocket.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> (/opt/homebridge/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Linux 6.1.21-v8+
npm ERR! gyp ERR! command "/opt/homebridge/bin/node" "/opt/homebridge/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /var/lib/homebridge/node_modules/bluetooth-hci-socket
npm ERR! gyp ERR! node -v v20.10.0
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok
Hi, same issue here, tried to rebuild/install npm and then reinstall the plugin, but nothing worked
Could someone already resolve the issue? I have the same issue here, I've set up my hygrometers as child bridge. After upgrading node.js and restarting HB, they don't even show up as child bridges anymore.
@hannseman any chance to see an update in the near future?
let's try and update the abandonware/noble dependency. i can give this a shot in the coming days
Hey fellas, I managed to fix it by removing and re-intalling the plugin! Give it a try!
I just published 3.4.0 to npm, it should work with node 20.x. Also when upgrading to a new major NodeJS version it's important to reinstall this plugin as its dependencies needs to be compiled against the new node version, simply removing it and reinstalling should be the easiest, something like:
rm -rf /usr/local/lib/node_modules/homebridge-mi-hygrothermograph/
npm install -g homebridge-mi-hygrothermograph
Expected Behavior
Working
Current Behavior
Initialize failed, seems like a dependency version problem Relevent error output shown below
Steps to Reproduce (for bugs)
Versions
v1.7.0
3.3.1
v20.10.0
Configuration
[2023/11/25 03:20:45] Loaded plugin: homebridge-mi-hygrothermograph@3.3.1 [2023/11/25 03:20:45] ==================== [2023/11/25 03:20:45] ERROR INITIALIZING PLUGIN homebridge-mi-hygrothermograph: [2023/11/25 03:20:45] Error: The module '/var/lib/homebridge/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/bluetooth-hci-socket/build/Release/bluetooth_hci_socket.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 108. This version of Node.js requires NODE_MODULE_VERSION 115. Please try re-compiling or re-installing the module (for instance, using (/var/lib/homebridge/node_modules/homebridge-mi-hygrothermograph/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:2:30)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
[2023/11/25 03:20:45] ====================
npm rebuild
ornpm install
). at Object.Module._extensions..node (node:internal/modules/cjs/loader:1473:18) at Module.load (node:internal/modules/cjs/loader:1207:32) at Function.Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object.