henry-spanka / homebridge-nubli

Homebridge platform plugin to manage Nuki Smart Locks via Bluetooth
MIT License
7 stars 0 forks source link

Error on pairing #5

Open leendersf opened 4 years ago

leendersf commented 4 years ago

Hello,

I have installed the plugin but when I try to pair it gives this error:

node node_modules/nubli/examples/pair.js internal/modules/cjs/loader.js:985 throw err; ^

Error: Cannot find module '/home/pi/homebridge/node_modules/nubli/examples/pair.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15) at Function.Module._load (internal/modules/cjs/loader.js:864:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) at internal/main/run_main_module.js:18:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

What can I do? Thank you in advance!

henry-spanka commented 4 years ago

Hi, which command did you use to install the plugin?

leendersf commented 4 years ago

I used node node_modules/nubli/examples/pair.js and I'm on Docker.

henry-spanka commented 4 years ago

I mean the command to install the homebridge plugin. Something like npm install homebridge-nubli.

What the output of: ls -l node_modules/homebridge-nubli/node_modules/

leendersf commented 4 years ago

I installed it through Homebridge -> plugins -> search -> install

leendersf commented 4 years ago

npm install --save homebridge-nubli@latest

And I get this warning: npm WARN deprecated mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

And a lot of other warnings but I am not fast enough to copy paste..

But the plugin is installed after this as it turns up as being installed.

leendersf commented 4 years ago

I managed to get all the installation logs:

USER: root DIR: /homebridge CMD: npm install --save homebridge-nubli@latest

npm WARN deprecated mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

usb@1.6.2 install /homebridge/node_modules/homebridge-nubli/node_modules/usb prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.3 prebuild-install info looking for cached prebuild @ /root/.npm/_prebuilds/e72387-usb-v1.6.2-node-v72-linuxmusl-arm.tar.gz prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.2/usb-v1.6.2-node-v72-linuxmusl-arm.tar.gz prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.2/usb-v1.6.2-node-v72-linuxmusl-arm.tar.gz prebuild-install WARN install No prebuilt binaries found (target=12.14.1 runtime=node arch=arm libc=musl platform=linux) make: Entering directory '/homebridge/node_modules/homebridge-nubli/node_modules/usb/build' CC(target) Release/obj.target/libusb/libusb/libusb/core.o CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o CC(target) Release/obj.target/libusb/libusb/libusb/io.o CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o CC(target) Release/obj.target/libusb/libusb/libusb/sync.o CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o ../libusb/libusb/os/linux_udev.c:40:10: fatal error: libudev.h: No such file or directory 40 | #include | ^~~ compilation terminated. make: *** [libusb.target.mk:146: Release/obj.target/libusb/libusb/libusb/os/linux_udev.o] Error 1 make: Leaving directory '/homebridge/node_modules/homebridge-nubli/node_modules/usb/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:223:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Linux 4.19.97-v7+ gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /homebridge/node_modules/homebridge-nubli/node_modules/usb gyp ERR! node -v v12.14.1 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok

bluetooth-hci-socket@0.5.1 install /homebridge/node_modules/homebridge-nubli/node_modules/bluetooth-hci-socket node-gyp rebuild

make: Entering directory '/homebridge/node_modules/homebridge-nubli/node_modules/bluetooth-hci-socket/build' CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o In file included from ../src/BluetoothHciSocket.cpp:8: ../../nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker)': ../../nan/nan.h:2298:62: warning: cast between incompatible function types from 'void ()(uv_work_t)' {aka 'void ()(uv_work_s)'} to 'uv_after_work_cb' {aka 'void ()(uv_work_s*, int)'} [-Wcast-function-type] 2298 | , reinterpret_cast(AsyncExecuteComplete) | ^ ../src/BluetoothHciSocket.cpp: In static member function 'static void BluetoothHciSocket::Init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)': ../src/BluetoothHciSocket.cpp:128:82: error: no matching function for call to 'v8::FunctionTemplate::GetFunction()' 128 | ew("BluetoothHciSocket").ToLocalChecked(), tmpl->GetFunction()); | ^

In file included from /root/.cache/node-gyp/12.14.1/include/node/node.h:63, from /root/.cache/node-gyp/12.14.1/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.cache/node-gyp/12.14.1/include/node/v8.h:5995:46: note: candidate: 'v8::MaybeLocal v8::FunctionTemplate::GetFunction(v8::Local)' 5995 | V8_WARN_UNUSED_RESULT MaybeLocal GetFunction( | ^~~ /root/.cache/node-gyp/12.14.1/include/node/v8.h:5995:46: note: candidate expects 1 argument, 0 provided ../src/BluetoothHciSocket.cpp: In member function 'void BluetoothHciSocket::poll()': ../src/BluetoothHciSocket.cpp:251:95: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)' is deprecated [-Wdeprecated-declarations] 251 | ject>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); | ^

In file included from ../src/BluetoothHciSocket.cpp:8: ../../nan/nan.h:1045:46: note: declared here 1045 | NAN_DEPRECATED inline v8::Local MakeCallback( | ^~~~ ../src/BluetoothHciSocket.cpp:251:95: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)' is deprecated [-Wdeprecated-declarations] 251 | ject>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); | ^

In file included from ../src/BluetoothHciSocket.cpp:8: ../../nan/nan.h:1045:46: note: declared here 1045 | NAN_DEPRECATED inline v8::Local MakeCallback( | ^~~~ ../src/BluetoothHciSocket.cpp: In member function 'void BluetoothHciSocket::emitErrnoError()': ../src/BluetoothHciSocket.cpp:269:109: warning: 'v8::Local v8::Object::Get(v8::Local)' is deprecated: Use maybe version [-Wdeprecated-declarations] 269 | tion>::Cast(globalObj->Get(Nan::New("Error").ToLocalChecked())); | ^

In file included from /root/.cache/node-gyp/12.14.1/include/node/v8-internal.h:14, from /root/.cache/node-gyp/12.14.1/include/node/v8.h:25, from /root/.cache/node-gyp/12.14.1/include/node/node.h:63, from /root/.cache/node-gyp/12.14.1/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.cache/node-gyp/12.14.1/include/node/v8.h:3457:51: note: declared here 3457 | V8_DEPRECATED("Use maybe version", Local Get(Local key)); | ^~~ /root/.cache/node-gyp/12.14.1/include/node/v8config.h:311:3: note: in definition of macro 'V8_DEPRECATED' 311 | declarator attribute((deprecated(message))) | ^~~~~~ ../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to 'v8::Function::NewInstance(int, v8::Local [1])' 275 | Local error = errorConstructor->NewInstance(1, constructorArgs); | ^ In file included from /root/.cache/node-gyp/12.14.1/include/node/node.h:63, from /root/.cache/node-gyp/12.14.1/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.cache/node-gyp/12.14.1/include/node/v8.h:4176:44: note: candidate: 'v8::MaybeLocal v8::Function::NewInstance(v8::Local, int, v8::Local) const' 4176 | V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( | ^~~ /root/.cache/node-gyp/12.14.1/include/node/v8.h:4176:44: note: candidate expects 3 arguments, 2 provided /root/.cache/node-gyp/12.14.1/include/node/v8.h:4179:44: note: candidate: 'v8::MaybeLocal v8::Function::NewInstance(v8::Local) const' 4179 | V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( | ^~~ /root/.cache/node-gyp/12.14.1/include/node/v8.h:4179:44: note: candidate expects 1 argument, 2 provided ../src/BluetoothHciSocket.cpp:282:93: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)' is deprecated [-Wdeprecated-declarations] 282 | ject>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); | ^

In file included from ../src/BluetoothHciSocket.cpp:8: ../../nan/nan.h:1045:46: note: declared here 1045 | NAN_DEPRECATED inline v8::Local MakeCallback( | ^~~~ ../src/BluetoothHciSocket.cpp:282:93: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)' is deprecated [-Wdeprecated-declarations] 282 | ject>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv); | ^

In file included from ../src/BluetoothHciSocket.cpp:8: ../../nan/nan.h:1045:46: note: declared here 1045 | NAN_DEPRECATED inline v8::Local 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::IntegerValue()' 395 | devId = arg0->IntegerValue(); | ^ In file included from /root/.cache/node-gyp/12.14.1/include/node/node.h:63, from /root/.cache/node-gyp/12.14.1/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: 'v8::Maybe v8::Value::IntegerValue(v8::Local) const' 2609 | V8_WARN_UNUSED_RESULT Maybe IntegerValue( | ^~~~ /root/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate expects 1 argument, 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::IntegerValue()' 417 | devId = arg0->IntegerValue(); | ^ In file included from /root/.cache/node-gyp/12.14.1/include/node/node.h:63, from /root/.cache/node-gyp/12.14.1/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate: 'v8::Maybe v8::Value::IntegerValue(v8::Local) const' 2609 | V8_WARN_UNUSED_RESULT Maybe IntegerValue( | ^~~~ /root/.cache/node-gyp/12.14.1/include/node/v8.h:2609:40: note: candidate expects 1 argument, 0 provided In file included from /root/.cache/node-gyp/12.14.1/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: ../src/BluetoothHciSocket.cpp: At global scope: /root/.cache/node-gyp/12.14.1/include/node/node.h:560:43: warning: cast between incompatible function types from 'void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void ()(v8::Local)'} to 'node::addon_register_func' {aka 'void ()(v8::Local, v8::Local, void)'} [-Wcast-function-type] 560 | (node::addon_register_func) (regfunc), \ | ^ /root/.cache/node-gyp/12.14.1/include/node/node.h:594:3: note: in expansion of macro 'NODE_MODULE_X' 594 | 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); | ^~~ In file included from /root/.cache/node-gyp/12.14.1/include/node/node.h:63, from /root/.cache/node-gyp/12.14.1/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /root/.cache/node-gyp/12.14.1/include/node/v8.h: In instantiation of 'void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&)]': /root/.cache/node-gyp/12.14.1/include/node/node_object_wrap.h:84:78: required from here /root/.cache/node-gyp/12.14.1/include/node/v8.h:10004:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo::Callback' {aka 'void ()(const v8::WeakCallbackInfo&)'} to 'Callback' {aka 'void ()(const v8::WeakCallbackInfo&)'} [-Wcast-function-type] 10004 | reinterpret_cast(callback), type); | ^~~~~~~~ /root/.cache/node-gyp/12.14.1/include/node/v8.h: In instantiation of 'void v8::PersistentBase::SetWeak(P, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfo&)]': ../../nan/nan_object_wrap.h:65:61: required from here /root/.cache/node-gyp/12.14.1/include/node/v8.h:10004:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo::Callback' {aka 'void ()(const v8::WeakCallbackInfo&)'} to 'Callback' {aka 'void ()(const v8::WeakCallbackInfo&)'} [-Wcast-function-type] make: *** [binding.target.mk:107: Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1 make: Leaving directory '/homebridge/node_modules/homebridge-nubli/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:223:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Linux 4.19.97-v7+ gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /homebridge/node_modules/homebridge-nubli/node_modules/bluetooth-hci-socket gyp ERR! node -v v12.14.1 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@~0.1.4 (node_modules/homebridge-nubli/node_modules/noble/node_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: usb@1.6.2 (node_modules/homebridge-nubli/node_modules/usb): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.6.2 install: prebuild-install --verbose || node-gyp rebuild npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/homebridge-nubli/node_modules/bluetooth-hci-socket): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 install: node-gyp rebuild npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

  • homebridge-nubli@1.0.2 added 576 packages from 752 contributors, updated 1 package and audited 17824 packages in 240.083s
henry-spanka commented 4 years ago

You are missing the libudev.h header file to compile the usb module. You can install it with apt install libudev-dev. Then try to install the plugin again and it should hopefully succeed. The warning messages are fine, you can ignore them.

leendersf commented 4 years ago

Hmm but then it says:

sudo apt install libudev-dev Reading package lists... Done Building dependency tree
Reading state information... Done libudev-dev is already the newest version (241-7~deb10u3+rpi1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

henry-spanka commented 4 years ago

Have you run this in the docker container?

leendersf commented 4 years ago

Then is says:

/homebridge # apt install libudev-dev /bin/sh: apt: not found /homebridge # sudo apt install libudev-dev sudo: apt: command not found

henry-spanka commented 4 years ago

Which docker image did you use? It may be Alpine Linux. You could try apk add eudev

leendersf commented 4 years ago

I did apk add eudev

then reinstalled the plugin.

Then tried to pair inside the docker terminal:

/homebridge # node node_modules/nubli/examples/pair.js internal/modules/cjs/loader.js:796 throw err; ^

Error: Cannot find module '/homebridge/node_modules/nubli/examples/pair.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17) at Function.Module._load (internal/modules/cjs/loader.js:686:27) at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) at internal/main/run_main_module.js:17:11 { code: 'MODULE_NOT_FOUND', requireStack: []

leendersf commented 4 years ago

Restarting homebridge says: [3/18/2020, 8:54:47 PM] ERROR LOADING PLUGIN homebridge-nubli: [3/18/2020, 8:54:47 PM] Error: Cannot find module 'bluetooth-hci-socket' Require stack:

  • /homebridge/node_modules/homebridge-nubli/node_modules/noble/lib/hci-socket/hci.js
  • /homebridge/node_modules/homebridge-nubli/node_modules/noble/lib/hci-socket/bindings.js
  • /homebridge/node_modules/homebridge-nubli/node_modules/noble/lib/resolve-bindings.js
  • /homebridge/node_modules/homebridge-nubli/node_modules/noble/index.js
  • /homebridge/node_modules/homebridge-nubli/node_modules/nubli/dist/lib/nubli.js
  • /homebridge/node_modules/homebridge-nubli/node_modules/nubli/dist/index.js
  • /homebridge/node_modules/homebridge-nubli/dist/lib/nubliPlatform.js
  • /homebridge/node_modules/homebridge-nubli/dist/index.js
  • /usr/local/lib/node_modules/homebridge/lib/plugin.js
  • /usr/local/lib/node_modules/homebridge/lib/server.js
  • /usr/local/lib/node_modules/homebridge/lib/cli.js
  • /usr/local/lib/node_modules/homebridge/bin/homebridge at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17) at Function.Module._load (internal/modules/cjs/loader.js:686:27) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/homebridge/node_modules/homebridge-nubli/node_modules/noble/lib/hci-socket/hci.js:6:26) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/homebridge/node_modules/homebridge-nubli/node_modules/noble/lib/hci-socket/bindings.js:9:11) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at module.exports (/homebridge/node_modules/homebridge-nubli/node_modules/noble/lib/resolve-bindings.js:13:12) at Object. (/homebridge/node_modules/homebridge-nubli/node_modules/noble/index.js:2:49) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) [3/18/2020, 8:54:47 PM] ====================
henry-spanka commented 4 years ago

That's because the bluetooth module failed to build. I think it only builds on node 8. So you might need to run another homebridge instance in a docker container which uses a node 8 image.

Ref henry-spanka/nubli#2

leendersf commented 4 years ago

Ooo.. to bad.. :-(

But thank you very much for your efforts Henry!!