Pi3 Gateway setup-hurdles

Started by GregMo, November 18, 2016, 07:34:10 AM

GregMo

I've come to ask for the dreaded help as a last resort.

I'm currently trying to still get the server stack installed and have been successful up until the .php test page to test the Nginx. I started with a clean image of Jessie and have backed it up until this point, learning that each time you make a mistake its easier to just reburn the backup than start from fresh.


I can install node and that is successful, and can test its version. It returns  0.10.29 even thought 0.10.28 was specified and the correct packages install. When I check the version of npm it says it does not exist. I can install it merely by using the repository and using "sudo apt-get install node" and installs version 1.4.21 .

My issue is when trying to install serialport, i get this error output
*********************************************************************

sudo npm install serialport
|
> [email protected] install /home/pi/gateway/node_modules/serialport
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.6/serialport-v4.0.6-node-v11-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v11 ABI) (falling back to source compile with node-gyp)
make: Entering directory '/home/pi/gateway/node_modules/serialport/build'
  CXX(target) Release/obj.target/serialport/src/serialport.o
In file included from ../src/./serialport.h:7:0,
                 from ../src/serialport.cpp:1:
../node_modules/nan/nan.h:324:47: error: 'REPLACE_INVALID_UTF8' is not a member of 'v8::String'
   static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
                                               ^
serialport.target.mk:84: recipe for target 'Release/obj.target/serialport/src/serialport.o' failed
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1
make: Leaving directory '/home/pi/gateway/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.4.26-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "build" "--fallback-to-build" "--module=/home/pi/gateway/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/home/pi/gateway/node_modules/serialport/build/Release"
gyp ERR! cwd /home/pi/gateway/node_modules/serialport
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp build --fallback-to-build --module=/home/pi/gateway/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/pi/gateway/node_modules/serialport/build/Release' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/pi/gateway/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:755:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:822:5)
node-pre-gyp ERR! System Linux 4.4.26-v7+
node-pre-gyp ERR! command "node" "/home/pi/gateway/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/gateway/node_modules/serialport
node-pre-gyp ERR! node -v v0.10.29
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp build --fallback-to-build --module=/home/pi/gateway/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/pi/gateway/node_modules/serialport/build/Release' (1)
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.4.26-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "serialport"
npm ERR! cwd /home/pi/gateway/node_modules
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/gateway/node_modules/npm-debug.log
npm ERR! not ok code 0
***************************************************************
I am a complete linux novice, but am trying. So there is clearly a 404 not found error (the location or file does not exist there), so it reverts to node-gyp. Now there is no serialport directory node_modules directory (there are in fact none).

Any help would be much appreciated as it seems I am now stuck.

Cheers
Greg

Felix

Greg, just last night I uploaded a new setup script that should solve all your problems and make the setup very easy.
I have yet to update all the documentation and make a new release (v8.9).

Instructions for how to use it are here.
Basically just download the setup script and run it as sudo. I would do this on a vanilla raspbian.

Please let me know how this goes!

GregMo

Hi Felix, thanks for the reply.

You cant make it to easy for us simpletons! haha.

I do apologise for my ignorance, but cannot seem to find a "vanilla raspbian" .img anywhere. I've seen the term a number of times, does this refer to the "lite" version of  the "jessie" distro?

I gave the "sudo wget https://github.com/LowPowerLab/RaspberryPi-Gateway/blob/master/.setup/gatewaysetup.sh"
a go from the readme page for the gatewaysetup.sh run fil, but it appeared to download an file of .html text I think and would not run. I then copied the text out the gatewaysetup.sh file your git repository and pasted it into a blank .sh file and ran it with bash which seemed to run through as expected. I tested it on "raw" standard image of jessie for now  since its what i had (I know its meant for vanilla) and it does not seem to load the nginx login page that i had previously gotten to with the manual install (prior to installing node/npm. I will keep persevering when I have some more time tomorrow.

Cheers
Greg

Felix

Vanilla means a raw/from scratch/unmodified image. Raspbian lite (jessie) on a Pi3 should work since that was part of testing this script.
Sounds like you are doing it right, although wget should get the .sh file.

I can do more testing now with the changes at github, but it should work as is already.
You don't even have to reboot after it's done, nginx should be operational and show you your login page.

Keep this warm, I will try to test again today.
Thanks.

Felix

Ok first of all the readme was wrong. I updated the README, please revisit it.

Then the link to the .sh was a github page, instead of the raw .sh, it's fixed now.

Second, I renamed the _piConfigs subdir to .setup and that messed up the script.

I made changes now and also included a notable set of changes suggested by Jonathan Karras (his github profile here), many thanks to his contributions.

So the setup script is updated and tested again to work, please see the README and try again.

GregMo

Hi Felix

I just wanted to let you know that your fast and easy setup appears to work like a charm(im sure you know this). It seems that sockets are now working etc. which I had failed with doing previously.

I havent had much time to try get everything working as I just need to figure out what I'm doing wrong as no nodes register or are picked up. Likely a GPIO issue which I will get sorted shortly. I did install minicom for fault finding, but for some reason I cant point it at the device located at /dev/serial0, but am getting there.

Thanks for the help and all your great work.

Cheers

microblades

Felix, thank you so much for this installation script. My Gateway is now up and running!

@GregMo you probably need to do this: https://lowpowerlab.com/guide/mightyhat/pi3-compatibility/

However, minicom shows I'm recieving data, but it's not yet getting picked up by the gateway.

Felix

Thanks guys, really happy to hear the setup script now makes it EASY to install the Gateway and supporting stack. Lots and lots of hours went into that :)

The setup does not really have a way to know which serial port you use and if you even use any.
So that part is something you have to figure out. By default it looks in /dev/ttyAMA0 which is the GPIO serial port. However if for instance you have a MoteinoUSB and it's the only serial device, when you plug it in, it would be available at /dev/ttyUSB0.

On Pi3 the GPIO serial is a little tricky since the bluetooth they added defaults to using the GPIO serial port (ttyAMA0), see this link for some help with that.

I am reading that there's now a Pi2 they released which is upgraded to a quad-900mhz armv7 which is great, closer to the Pi3 (which is quad 1.2ghz armv7) but without the bluetooth and wifi.

I might alter the setup script for those that have a MightyHat or use a barebones non-USB Moteino with the GPIO, to disable the bluetooth, but there's a bunch of checking and testing to do.

GregMo

Thanks Felix.

I feel like for the last week I have been trying to do the same thing (albeit variations on the theme) to get my Pi3 UART functioning. I must double check on a clean install to see if this finally what sorted my problems (could have been a combination there of), but this is the last blog I followed that I suspect solved my issues:

http://www.briandorey.com/post/Raspberry-Pi-3-UART-Overlay-Workaround

Finally have nodes being picked up!

Cheers
Greg