GEMakers / green-bean

An Adapter for the Appliance Maker Community
GNU General Public License v2.0
57 stars 23 forks source link

npm install failure #11

Open DanMcLaughlin opened 7 years ago

DanMcLaughlin commented 7 years ago

Tried install on a ARM Pi and Intel laptop - same result. I dug in and manually installed a bunch of dependencies (libhid and such) to see if I could get it to complete but it still petered out. At the moment there's no way to use this library, and my new green-bean is sitting there lonely.

npm install green-bean

node-hid@0.5.7 install /home/auser/node_modules/node-hid prebuild-install || node-gyp rebuild /usr/bin/env: ‘node’: No such file or directory /bin/sh: 1: node: not found gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:354:16) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Linux 4.4.0-92-generic gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /home/auser/node_modules/node-hid gyp ERR! node -v v4.2.6 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open '/home/auser/package.json' npm WARN auser No description npm WARN auser No repository field. npm WARN auser No README data npm WARN auser No license field. npm ERR! Linux 4.4.0-92-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "green-bean" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE

npm ERR! node-hid@0.5.7 install: prebuild-install || node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-hid@0.5.7 install script 'prebuild-install || node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the node-hid package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! prebuild-install || node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs node-hid npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls node-hid npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /home/auser/npm-debug.log

the1snm commented 6 years ago

Were you ever able to make any progress on this? I'm running in to a similar situation, I've been trying off & on for weeks to get this working on a fresh RPi install. No combination has worked as of yet on my end.

DanMcLaughlin commented 6 years ago

No I haven't worked on it, unfortunately this looks like abandonware so we'll have to fix it ourselves, interested @the1snm ?

the1snm commented 6 years ago

I'm definately interested in seeing this up and working, I'm starting to think some of the trouble could be related to a bad GB module. I saw a post on Firstbuilds site here: https://cocreate.firstbuild.com/u/mylescaley/greenbeanmakermodule?d=gxcvxkp3rrycrmv5df54mfgvi where someone had trouble connecting and the lights would just flash alternating on the GB module. A replacement module fixed this for him, mine do the same thing. I actually have a 2nd GB module I could test but after hours messing with my RPi image last night I'm gonna wipe and start again. I don't trust the integrity of the software at this point. I'll let you know if I make some headway.

the1snm commented 6 years ago

Well good news, I've been able to get my RPi to finally connect after 4-5 hours working on it today. More good news, I documented every step I did along the way. The bad news I don't know for sure which are the critical steps needed and it's a bit inefficient I'm sure. I'll post the steps below so if you want to at least replicate my steps and we can work on streamlining later. The first thing I did was wipe and refresh my RPi with Noobs, made sure my wifi worked and updated the default password. Then in terminal (not root unless specified)

  1. Curl –sL http://deb.nodesource.com/setup_8.x | sudo -E bash - (updates to latest Node, didn't stick with this see step later on).
  2. Sudo su (switches to root)
  3. Apt-get install nodejs (selected yes when asked)
  4. Node –v (returned v8.9.1)
  5. Npm –v (returned 5.5.1)
  6. sudo apt update
  7. sudo apt full-upgrade
  8. Exit (returns to normal user)
  9. Create GreenBean Folder in Home/Pi/ (doesn't matter due to location of installed node_modules later)
  10. Reboot
  11. npm install git+https://github.com/GEMakers/gea-sdk.git (Returned warnings about multiple missing things)
  12. npm install git+https://github.com/GEMakers/gea-adapter-usb.git (similar warnings as #11)
  13. cd ~/GreenBean/
  14. npm install gea-sdk (returns error that latest gea-sdk@ latest can’t be found yada yada)
  15. npm install gea-adapter-usb (returns error that latest gea-adapter-usb@ latest can’t be found yada yada)
  16. npm install green-bean (got error building node-hid@0.5.7 couldn't be found yada yada) No hid support for 8.9.1 only up to V7 but not for RPi though per node-hid website Downgrading the node version now
  17. sudo npm cache clean –f
  18. sudo npm install –g n
  19. sudo n 7.10.1
  20. npm install node-hid (errors that no respository matches, need to build one manually if I want it) Need to manually build the node-hid now
  21. sudo su (switch to root)
  22. npm install –g node-gyp
  23. apt install build-essential git
  24. apt install gcc-4.8 g++-4.8 && export CXX=g++-4.8 (clicked Y when asked)
  25. Sudo apt install libusb-1.0-0 libusb-1.0-0-dev
  26. Npm install node-hid –build-from-source
  27. Exit (leave root)
  28. npm install green-bean (SEEMS TO WORK!)
  29. npm install geospringhack (doesn’t work, no results)
  30. manually downloaded the GeoSpringHack files from GitHub
  31. expanded them and moved to Home/Pi/Node_Modules/ Should see Home/Pi/Node_Modules/Example and Lib now as well as dozens of folders in Node_Modules folder
  32. terminal> navigated to the example folder above and ran Sudo Node GeoSpring-Test.js (while plugged into the water heater of course) I got a data dump and then errors at the end about the kWh can't be found etc etc Be aware in my case the water heater is normally on eHeat and at 120 degrees. This test script changes to hybrid and sets the temp to 140. I've begun playing with the script some and have successfully changed the temps and modes (as well as removed the lines about the kWh causing trouble.

Hope this helps and I'll update as I learn more. Steve

DanMcLaughlin commented 6 years ago

Great news! Thanks for the work Steve, I'll give it a shot and let you know. Maybe we can formalize the changes in a new repo

the1snm commented 6 years ago

I haven't had a chance to go back and test some things the last couple days but I suspect the most crucial step is 21 to 26. Many people using the GreenBean online seem to be using a mac or pc box to connect where the node-hid is supported. Thats my next test is to start fresh, install node and compile node-hid then install GE & GreenBean packages. I suspect that might do it. I won't be able to test though for several more days as my evenings are full most of this week. Good luck on your end and let me know how you turn out.

JonnyBoats commented 6 years ago

Thanks all, and particularly Steve, for your contributions to getting this running on a Raspberry PI. I will be watching with interest and hop to test in the near future.

richterdc commented 6 years ago

I was running into the same issues, RasPi B+ Arm6 Rasbian Stretch, however I'm connecting to a GE fridge. Had some issues with node and npm versions. Ended up doing the below first then following steps 21 - 28 of Steve's awesome step by step.

Install Node

  1. wget https://nodejs.org/dist/v7.10.1/node-v7.10.1-linux-armv6l.tar.xz

  2. tar -xvf https://nodejs.org/dist/v7.10.1/node-v7.10.1-linux-armv6l.tar.xz

  3. cd node-v7.10.1-linux-armv6l/

  4. sudo cp -R * /usr/local/

  5. Verify versions. npm -v 4.2.0 node -v 7.10.1

  6. Followed Steve's Instructions 21 -28 above.

Make sure Greenbean is connected and bingo! I am able to communicate with the fridge. Guessing it would be the same for any of the supported GE devices.

Had some USB issues as well (cheap cable missing or broken data pair) But if its helps anyone here and the devices you should see in /dev/ hidraw0 , usb.

Hope this helps someone.

Dustin``

As a bit of a side note as well, i did not want to deal with having the greenbean nor the raspi sitting somewhere near the appliance, fridge in the case. As such i ran about 20' of Cat6 terminated on B both ends. Seems to work great so far.