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

ble issue #46

Closed
vash3d opened this issue Mar 10, 2018 · 10 comments
Closed

ble issue #46

vash3d opened this issue Mar 10, 2018 · 10 comments

Comments

@vash3d
Copy link

vash3d commented Mar 10, 2018

Hi all,
I'm trying to setup room assistant but I've one issue.

If I set ble to true in the config file I get this error.

> room-assistant@0.4.1 start /home/room-assistant
> node index.js "index.js"

module.js:471
    throw err;
    ^

Error: Cannot find module '../build/Release/binding.node'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/room-assistant/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! room-assistant@0.4.1 start: `node index.js "index.js"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the room-assistant@0.4.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-03-10T15_17_56_852Z-debug.log

If I disable ble (set to false) room assistant starts fine but obviously it is useless

this is how I've setup the ble part in the config file:

  "ble": {
    "enabled": true,
    "channel": "room_presence",
    "max_distance": 3,
    "blacklist": [],
    "whitelist": ["6708eda4278d"],
    "use_mac": true,
    "system_noise": 0.01,
    "measurement_noise": 3,
    "update_frequency": 5000
  },

Any hint? What am I doing wrong?
Thanks.

@mKeRix
Copy link
Owner

mKeRix commented Mar 10, 2018

My first guess would be that the dependency installation didn't go through correctly. Could you try removing the node_modules folder and then running npm install again?

@vash3d
Copy link
Author

vash3d commented Mar 10, 2018

Thanks for the answer but it doesn't solve.
I forgot to say that I have to install with

sudo npm install --unsafe-perm

If I don't use the --unsafe-perm parameter I get this error during installation:

> bignum@0.11.0 install /home/room-assistant/node_modules/bignum
> node-gyp configure build

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.11.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"

@vash3d
Copy link
Author

vash3d commented Mar 11, 2018

I've started from scratch...
flashed an sd card with hassbian
apt-get update / apt-get upgrade
installed latests version of nodejs 9.8.0
installed dependencies:
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev libusb-1.0-0-dev
cloned room assistant.

Then if I run: sudo npm install I get

pi@hassbian:/home/room-assistant $ sudo npm install

> bignum@0.11.0 install /home/room-assistant/node_modules/bignum
> node-gyp configure build

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/9.8.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/room-assistant/node_modules/bignum/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/room-assistant/node_modules/bignum/.node-gyp/9.8.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/room-assistant/node_modules/bignum/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/room-assistant/node_modules/bignum/.node-gyp/9.8.0"

...endlessly

If I run: sudo npm install -g I get

pi@hassbian:/home/room-assistant $ sudo npm install -g
npm WARN lifecycle bignum@0.11.0~install: cannot run in wd %s %s (wd=%s) bignum@0.11.0 node-gyp configure build /home/room-assistant/node_modules/bignum
npm WARN lifecycle usb@1.3.1~install: cannot run in wd %s %s (wd=%s) usb@1.3.1 node-pre-gyp install --fallback-to-build /home/room-assistant/node_modules/usb
npm WARN lifecycle bluetooth-hci-socket@0.5.1~install: cannot run in wd %s %s (wd=%s) bluetooth-hci-socket@0.5.1 node-gyp rebuild /home/room-assistant/node_modules/bluetooth-hci-socket
npm WARN lifecycle node-hid@0.5.7~install: cannot run in wd %s %s (wd=%s) node-hid@0.5.7 prebuild-install || node-gyp rebuild /home/room-assistant/node_modules/node-hid
npm WARN rollback Rolling back xpc-connection@0.1.4 failed (this is probably harmless): /home/room-assistant/node_modules/xpc-connection is not a child of /usr/lib
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (../../home/room-assistant/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"})

+ room-assistant@0.4.1
added 248 packages in 37.87s

And if I run: sudo npm install --unsafe-perm -g I get

pi@hassbian:/home/room-assistant $ sudo npm install -g --unsafe-perm
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/room-assistant/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"})

+ room-assistant@0.4.1
updated 1 package in 8.101s

Maybe the problem is is hassbian?

@mKeRix
Copy link
Owner

mKeRix commented Mar 15, 2018

The only thing different from the instructions that I see here is you running npm install as sudo, which shouldn't be needed and may cause file permission issues depending on the situation. Everything else looks good to me. Possibly you should run sudo rm -R node_modules/ in the room-assistant directory to clear out the local dependency folder and then run npm install as the pi user, without sudo.

Technically Hassbian shouldn't be an issue since it is based on the normal Raspbian - which works fine for all my devices. If this doesn't work out for you I'll debug this further with an actual Hassbian instance.

(sorry for being slow with answering lately)

@nemmeh
Copy link

nemmeh commented Apr 18, 2018

I had this same issue on 9.8 running on a Pi Zero W.
I ended up downgrading to 6.11.5 and had great success.

Good luck.

@mredone
Copy link

mredone commented Apr 20, 2018

I have same problem:
error:

usb_bindings.target.mk:104: recipe for target 'Release/obj.target/usb_bindings/src/node_usb.o' failed
make: *** [Release/obj.target/usb_bindings/src/node_usb.o] Error 1
make: Leaving directory '/home/pi/room-assistant/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:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:180:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.9.80+
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=/home/pi/room-assistant/node_modules/usb/src/binding/usb_bindings.node" "--module_name=usb_bindings" "--module_path=/home/pi/room-assistant/node_modules/usb/src/binding"
gyp ERR! cwd /home/pi/room-assistant/node_modules/usb
gyp ERR! node -v v9.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build 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=/home/pi/room-assistant/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/home/pi/room-assistant/node_modules/usb/src/binding' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/pi/room-assistant/node_modules/usb/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:180:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:936:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Linux 4.9.80+
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/room-assistant/node_modules/usb/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/room-assistant/node_modules/usb
node-pre-gyp ERR! node -v v9.11.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.30
node-pre-gyp ERR! not ok
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=/home/pi/room-assistant/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/home/pi/room-assistant/node_modules/usb/src/binding' (1)
Im going right with readme instruction

@nemmeh
Copy link

nemmeh commented Apr 26, 2018

@mredone have you tried rolling back your node version?

@mredone
Copy link

mredone commented May 19, 2018

Now i roll back to 6.11.5 and everything works fine.

@voglster
Copy link

voglster commented Jun 3, 2018

Error occurs in node 10... but working in 9.11.1
latest rasbian. Pi Zero W (arm v6)
node installed like this:
https://www.thepolyglotdeveloper.com/2018/03/install-nodejs-raspberry-pi-zero-w-nodesource/
worked out of the box

@mKeRix mKeRix closed this as completed Jul 14, 2018
@madrose
Copy link

madrose commented Sep 20, 2018

I had exactly the same issue on a raspberry Pi, and I noticed that the room-assistant folder is owned by root after I did git clone. I did sudo chown -R pi:pi ~/room-assistant and run the commands again.
All worked after that

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

6 participants