Noble BLE node not working after updating

Hi,

I updated node-red to newest version and Node Js to version 14 (been doing it for 6 hours now..) And finally I think I got most of the things working, but critical application is not working. I have sensors that I am reading with the node-red-contrib-noble module.

It is correctly shown in the list of nodes
image
But when ever I place it somewhere I get an error "module_not_found".

Been trying to reinstall it from GUI and console, but it is not helping. When installing it from the console I get following errors:

[code]pi@raspberrypi:~/.node-red $ npm install node-red-contrib-noble

> bluetooth-hci-socket@0.5.1 install /home/pi/.node-red/node_modules/bluetooth-hci-socket
> node-gyp rebuild

make: Siirrytään hakemistoon ”/home/pi/.node-red/node_modules/bluetooth-hci-socket/build”
  CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
../src/BluetoothHciSocket.cpp: In static member function ‘static void BluetoothHciSocket::In                                       it(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’:
../src/BluetoothHciSocket.cpp:128:82: error: no matching function for call to ‘v8::FunctionT                                       emplate::GetFunction()’
  128 |  target->Set(Nan::New("BluetoothHciSocket").ToLocalChecked(), tmpl->GetFunction());
      |                                                                                 ^

In file included from /home/pi/.cache/node-gyp/14.20.0/include/node/node.h:67,
                 from /home/pi/.cache/node-gyp/14.20.0/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:6482:46: note: candidate: ‘v8::MaybeLocal                                       <v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)’
 6482 |   V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
      |                                              ^~~~~~~~~~~
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:6482:46: note:   candidate expects 1 argu                                       ment, 0 provided
../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’:
../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::L                                       ocal<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdepre                                       cated-declarations]
  251 | Callback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
      |                                                                                  ^

In file included from ../src/BluetoothHciSocket.cpp:8:
../../nan/nan.h:1051:46: note: declared here
 1051 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
      |                                              ^~~~~~~~~~~~
../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError(                                        ’:
../src/BluetoothHciSocket.cpp:269:109: error: no matching function for call to ‘v8::Object::                                       Get(v8::Local<v8::String>)’
  269 | ructor = Local<Function>::Cast(globalObj->Get(Nan::New("Error").ToLocalChecked()));
      |                                                                                 ^

In file included from /home/pi/.cache/node-gyp/14.20.0/include/node/node.h:67,
                 from /home/pi/.cache/node-gyp/14.20.0/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:3717:43: note: candidate: ‘v8::MaybeLocal                                       <v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3717 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:3717:43: note:   candidate expects 2 argu                                       ments, 1 provided
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:3720:43: note: candidate: ‘v8::MaybeLocal                                       <v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3720 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:3720:43: note:   candidate expects 2 argu                                       ments, 1 provided
../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to ‘v8::Function:                                       :NewInstance(int, v8::Local<v8::Value> [1])’
  275 |   Local<Value> error = errorConstructor->NewInstance(1, constructorArgs);
      |                                                                        ^
In file included from /home/pi/.cache/node-gyp/14.20.0/include/node/node.h:67,
                 from /home/pi/.cache/node-gyp/14.20.0/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:4451:44: note: candidate: ‘v8::MaybeLocal                                       <v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) c                                       onst’
 4451 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
      |                                            ^~~~~~~~~~~
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:4451:44: note:   candidate expects 3 argu                                       ments, 2 provided
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:4454:44: note: candidate: ‘v8::MaybeLocal                                       <v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const’
 4454 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
      |                                            ^~~~~~~~~~~
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:4454:44: note:   candidate expects 1 argu                                       ment, 2 provided
../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::L                                       ocal<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdepre                                       cated-declarations]
  282 | Callback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
      |                                                                                  ^

In file included from ../src/BluetoothHciSocket.cpp:8:
../../nan/nan.h:1051:46: note: declared here
 1051 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
      |                                              ^~~~~~~~~~~~
../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE                                        BluetoothHciSocket::BindRaw(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/BluetoothHciSocket.cpp:395:34: error: no matching function for call to ‘v8::Value::In                                       tegerValue()’
  395 |       devId = arg0->IntegerValue();
      |                                  ^
In file included from /home/pi/.cache/node-gyp/14.20.0/include/node/node.h:67,
                 from /home/pi/.cache/node-gyp/14.20.0/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:2863:40: note: candidate: ‘v8::Maybe<long                                        long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const’
 2863 |   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
      |                                        ^~~~~~~~~~~~
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:2863:40: note:   candidate expects 1 argu                                       ment, 0 provided
../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE                                        BluetoothHciSocket::BindUser(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/BluetoothHciSocket.cpp:417:34: error: no matching function for call to ‘v8::Value::In                                       tegerValue()’
  417 |       devId = arg0->IntegerValue();
      |                                  ^
In file included from /home/pi/.cache/node-gyp/14.20.0/include/node/node.h:67,
                 from /home/pi/.cache/node-gyp/14.20.0/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:2863:40: note: candidate: ‘v8::Maybe<long                                        long int> v8::Value::IntegerValue(v8::Local<v8::Context>) const’
 2863 |   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
      |                                        ^~~~~~~~~~~~
/home/pi/.cache/node-gyp/14.20.0/include/node/v8.h:2863:40: note:   candidate expects 1 argu                                       ment, 0 provided
In file included from /home/pi/.cache/node-gyp/14.20.0/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
../src/BluetoothHciSocket.cpp: At global scope:
/home/pi/.cache/node-gyp/14.20.0/include/node/node.h:793:7: warning: cast between incompatib                                       le 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>, v                                       8::Local<v8::Value>, void*)’} [-Wcast-function-type]
  793 |       (node::addon_register_func) (regfunc),                          \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/.cache/node-gyp/14.20.0/include/node/node.h:827:3: note: in expansion of macro ‘NOD                                       E_MODULE_X’
  827 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/BluetoothHciSocket.cpp:499:1: note: in expansion of macro ‘NODE_MODULE’
  499 | NODE_MODULE(binding, BluetoothHciSocket::Init);
      | ^~~~~~~~~~~
make: *** [binding.target.mk:109: Release/obj.target/binding/src/BluetoothHciSocket.o] Virhe                                        1
make: Poistutaan hakemistosta ”/home/pi/.node-red/node_modules/bluetooth-hci-socket/build”
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node                                       -gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Linux 5.15.32-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gy                                       p/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/bluetooth-hci-socket
gyp ERR! node -v v14.20.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@~0.1.4 (node_modules/noble/no                                       de_modules/xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4:                                        wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/blu                                       etooth-hci-socket):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 install: `node-gy                                       p rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ node-red-contrib-noble@0.3.0
removed 1 package, updated 1 package and audited 1329 packages in 59.136s

96 packages are looking for funding
  run `npm fund` for details

found 44 vulnerabilities (7 low, 21 moderate, 13 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details[/code]

Anyone bumped into this and could help?

Best regards

Also noticed, that any bluetooth -related does not work. Tried to interpret the errors, maybe something with this bluetooth hci module?

Since you also updated the version of Nodejs .. some npm modules that depend on C++ binaries need to be rebuilt.

From your .node-red folder run npm rebuild

hope it fixes the problem .. cause that node hasnt been updated for more than six years

This appears to be the main problem, it is required by the noble node and it will not install. It seems to be no longer supported, see numerous issues on Issues ¡ noble/node-bluetooth-hci-socket ¡ GitHub and in particular Maintenance status ? ¡ Issue #123 ¡ noble/node-bluetooth-hci-socket ¡ GitHub which points to a fork that does appear to be maintained. To use it I think it is necessary to fork the noble node and include the hci fork, instead of the original, in the noble node's package.json

a quick look at the forks - this fork of node-red-contrib-noble by MatsA looks to be the most promising (states "works up to Node 16" and "node-red v3.0.1"). It references the abandonware fork of noble. However doesnt appear to be added to NPM or the node-red library so you will need to manually install.

I would recommend you uninstall any BT stuff you have added and follow instructions in the readme to the letter.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.