Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install fails on Homebridge on Raspberry Pi3+ #34

Open
simplenotezy opened this issue Oct 25, 2020 · 6 comments
Open

Install fails on Homebridge on Raspberry Pi3+ #34

simplenotezy opened this issue Oct 25, 2020 · 6 comments

Comments

@simplenotezy
Copy link

Upon running npm install -g noble I get below error:

make: *** [binding.target.mk:109: Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/noble/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:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.4.51-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 /usr/local/lib/node_modules/noble/node_modules/bluetooth-hci-socket
gyp ERR! node -v v12.19.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/node_modules/xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/noble/node_modules/bluetooth-hci-socket):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
updated 1 package in 47.272s

If I run it with sudo (which I believe I am not supposed to, as my node_modules is owned by my current user), I get this error:

pi@homebridge:~ $ sudo npm install -g noble

> [email protected] install /usr/local/lib/node_modules/noble/node_modules/usb
> prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.6
prebuild-install WARN install EACCES: permission denied, access '/root/.npm'
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/12.19.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/noble/node_modules/usb/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/noble/node_modules/usb/.node-gyp'
gyp ERR! System Linux 5.4.51-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 /usr/local/lib/node_modules/noble/node_modules/usb
gyp ERR! node -v v12.19.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

> [email protected] install /usr/local/lib/node_modules/noble/node_modules/bluetooth-hci-socket
> node-gyp rebuild

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/12.19.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/noble/node_modules/bluetooth-hci-socket/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/noble/node_modules/bluetooth-hci-socket/.node-gyp'
gyp ERR! System Linux 5.4.51-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 /usr/local/lib/node_modules/noble/node_modules/bluetooth-hci-socket
gyp ERR! node -v v12.19.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/node_modules/xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/noble/node_modules/usb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `prebuild-install --verbose || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/noble/node_modules/bluetooth-hci-socket):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
updated 1 package in 13.782s

Any ideas on how I can proceed?

@gdavids57
Copy link

This plugin relies on the noble utility to implement a BLE Central device. The bluetooth-hci-socket version relied upon by the noble package does not work with nodejs versions newer than v8. The abandonware version of bluetooth-hci-socket will build on my RPi using nodejs v14. (see https://www.npmjs.com/package/@abandonware/bluetooth-hci-socket). I'm still working to get noble to use the alternate bluetooth module.

@uswong
Copy link

uswong commented Jun 15, 2022

Any solution to this issue yet?

I have successfully installed home bridge-bluetooth but homebridge log shows the following error:

Screen Shot 2022-06-15 at 1 31 24 pm

Any help is much appreciated.

@uswong
Copy link

uswong commented Jun 15, 2022

The solution suggested by @gdavids57 actually works for me. Please do not forget to change all instances of require('bluetooth-hci-socket') to require('@abandonware/bluetooth-hci-socket').

Moreover, the chalk version 5 does not work for this plugin as the moment. So what you need to do is to downgrade chalk version to version 4. What I have done is as follow:

sudo npm uninstall chalk
sudo npm install [email protected]

@uswong
Copy link

uswong commented Jun 15, 2022

I have a Bluetooth version of Xiaomi Power Strip 2 (model: qmi.plug.pvs3). It connected ok, but no service discovered.

This is my config file:

 {
     "platform": "Bluetooth",
     "accessories": [
         {
             "name": "Xiaomi Outlet 2",
             "address": "68:AB:BC:07:50:AD",
             "services": [
                 {
                     "name": "JBL",
                     "type": "Outlet",
                     "UUID": "80c77a06-ec5c-11ec-8ea0-0242ac120002",
                     "characteristics": [
                         {
                             "type": "On",
                             "UUID": "80c77a06-ec5c-11ec-8ea0-0242ac120002"
                         }
                     ]
                 }
             ]
         }
     ]
 }

The log on Homebridge as follow:

[15/06/2022, 9:43:48 pm] [Bluetooth] [Xiaomi Outlet 2] Connected | Xiaomi Outlet 2 (68:AB:BC:07:50:AD)
[15/06/2022, 9:43:48 pm] [Bluetooth] [Xiaomi Outlet 2] No services discovered

What have I done wrong?

@kard8
Copy link

kard8 commented Sep 1, 2022

The solution suggested by @gdavids57 actually works for me. Please do not forget to change all instances of require('bluetooth-hci-socket') to require('@abandonware/bluetooth-hci-socket').

Hi @uswong.

Can you please tell me how to find the instances as mentioned in your reply

@uswong
Copy link

uswong commented Sep 2, 2022

cd to your homebridge-bluetooth plugin directory and try using the following command:
grep -r bluetooth-hci-socket *|grep require

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants