Picking platform for home server... (BBB or rPi3?)

Hello all.
I would like to setup a home “edge server” running Node-Red for various things… I have both a BBB (Beaglebone Black) and an rPi3 sitting here. Which one do you recommend for best learning/support and various home-automation things (zwave, controlling color-changing-lights via DMX, etc). Is the rPi3 experience much more streamlined due to higher numbers of users? Any comments appreciated. Thx! -VoltVisionFrenchy (aka Steve French)

PS- I already have a BBB sitting here running the newest Node-Red that I have been using, but I think I messed it up because suddenly there was two Node-Reds…one installed as root and one installed as user “Debian”…I deleted the Debian folders, but now I cannot import external modules no matter what I do… so I think I just want to start over before asking for help trying to get it all sorted out. The BBB solution seems strange because I have read “never do npm install as root”, but you have to on the BBB because the .node-red folder is in the root home directory. I will pay closer attention next time.

BBB seems to be more powerful while RPi3 has wider support and documentation, as far as I have seen, so depends what exactly you expect to do and with how many problems you wanted to deal with.

Regards

The BBB guys do package it up slightly differently - so it’s best to stick with their way on the BBB so that their updates will just work. Yes we prefer not to run as root but we aren’t going to be overly zealous about it.

[[EDIT: I figured it out!! see my below reply]]

dceejay,
Thanks for the response! If you have a minute can you comment on which is the correct settings.js below? I am trying to keep the words short, but thorough:

I have a completely fresh out of the oven install up and running on my BBB as of today. My failures from yesterday caused me to start over today fresh.

  • Image: bone-debian-9.3-iot-armhf-2018-03-05-4gb.img

For updating all I have done thus far is:

  • sudo apt-get update
  • sudo apt-get dist-upgrade

Here are some stats:
which node-red
/usr/local/bin/node-red

node -v
v6.14.2

npm -v
3.10.10

node-red -? | head -n 1 | cut -d " " -f 2
v0.18.7

I am getting ready to try to include an external called “tinycolor2” for use in Node-Red…
…yesterday I spent >4 hours and could not get it working…
[[although I did get it working a few years ago on a Digital Ocean droplet…
…not sure if my problem is BBB platform-specific]]]

So, I need to modify the settings.js file for node-red, but I see two different candidates…
…which is the correct one?
/usr/local/lib/node_modules/node-red/settings.js
/root/.node-red/settings.js

I can try modifying both of them, but this also affects where I install “tinycolor2” and whether I need to run this as root (I installed this yesterday in several different places, but nothing worked):
npm install tinycolor2

In the settings.js file, I need to put this:
functionGlobalContext: {tinycolor2:require(‘tinycolor2’)}

Not sure why the above didnt work yesterday for me. Maybe I was editing the wrong settings.js or perhaps installing “tinycolor2” in the wrong location? I am not sure, but I dont want it to happen again!

I was restarting node-red with this:
sudo systemctl restart node-red

…and I was watching the node-red log with this:
sudo systemctl status node-red

Not sure if this is helpful:
$ sudo systemctl status node-red
● node-red.service - Start Node-RED
Loaded: loaded (/lib/systemd/system/node-red.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2018-06-11 16:57:22 EDT; 1h 1min ago
Main PID: 874 (node-red.sh)
Tasks: 11 (limit: 4915)
CGroup: /system.slice/node-red.service
├─874 /bin/bash - /usr/bin/node-red.sh
└─875 node-red

Any pointers would be helpful. Thx -VoltVisionFrenchy (aka Steve French)

[[EDIT: I figured it out! See my below reply!]]

It is happening again! arrrgh

I put this in a function node:
var tinycolor = global.get(‘tinycolor2’);
var color = tinycolor(msg.payload);
var triad = tinycolor(msg.payload).triad();
triad = triad[1];
msg.payload = tinycolor(triad).toHexString()
return msg;

…the first thing I do is check the log and I got this:

sudo systemctl status node-red

Jun 11 17:51:12 vBBB13 Node-RED[874]: 11 Jun 17:51:12 - [error] [function:98da5b88.85cc68] TypeError: tinycolor is not a function
[[[NOTE: why didnt it complain about the global.get first?]]]

ok, the first settings.js file that I will try is this one:
/root/.node-red/settings.js

I add this:
functionGlobalContext: {
// os:require(‘os’),
tinycolor2:require(“tinycolor2”)
// j5board:require(“johnny-five”).Board({repl:false})
},

…and restarted node-red and got this:
Jun 11 18:03:42 vBBB13 systemd[1]: Started Start Node-RED.
Jun 11 18:03:48 vBBB13 Node-RED[925]: Error loading settings file: /root/.node-red/settings.js
Jun 11 18:03:48 vBBB13 Node-RED[925]: Error: Cannot find module ‘tinycolor2’

so, lets install “tinycolor2” in this location:
/root/.node-red

before doing anything I have this:
root@vBBB13:~/.node-red# ls
flows_vBBB13.json lib node_modules package.json settings.js

root@vBBB13:~/.node-red# cd node_modules/
root@vBBB13:~/.node-red/node_modules# ls
[[[[nothing was there]]]]

root@vBBB13:~/.node-red# npm install tinycolor2
node-red-project@0.0.1 /root/.node-red
└── tinycolor2@1.4.1

npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

now it is there
root@vBBB13:~/.node-red# ls
flows_vBBB13.json lib node_modules package.json settings.js
root@vBBB13:~/.node-red# cd node_modules/
root@vBBB13:~/.node-red/node_modules# ls
tinycolor2

…but I restart node-red and I still get this:

root@vBBB13:~/.node-red/node_modules# sudo systemctl status node-red
● node-red.service - Start Node-RED
Loaded: loaded (/lib/systemd/system/node-red.service; disabled; vendor preset: enabled)
Active: active (exited) since Mon 2018-06-11 18:09:08 EDT; 9s ago
Process: 967 ExecStart=/usr/bin/node-red.sh (code=exited, status=0/SUCCESS)
Main PID: 967 (code=exited, status=0/SUCCESS)

Jun 11 18:09:08 vBBB13 systemd[1]: Started Start Node-RED.
Jun 11 18:09:15 vBBB13 Node-RED[967]: Error loading settings file: /root/.node-red/settings.js
Jun 11 18:09:15 vBBB13 Node-RED[967]: Error: Cannot find module ‘tinycolor2’

What am I doing wrong?

davidcgu,
well apparently I must love dealing with problems because I am trying the BBB again and I have the same problem as before…still not sure if it is user error or BBB issues when trying to include external modules.

Hahah, I see mate, you told that you were having a RPi3 on hands, why just not give it a try?

Sometimes live could be much easier if we wanted :stuck_out_tongue:

Regards

ok, I finally got the external library “tinycolor2” working in node-red on the BBB!!!
(Probably just a bad case of “hardware-guy-itis”)

I did need to do the “functionGlobalContext modification” in the settings.js file located here:
/root/.node-red/settings.js

…BUT, I thought I was following directions when I was installing “tinycolor2” in the above location also…but apparently I had to do it in the location of the other settings.js file here:
/usr/local/lib/node_modules/node-red/settings.js
/usr/local/lib/node_modules/node-red/

Of course, experienced software people would have had that working in seconds…
…but for this hardware guy it did take two days of wonderful learning.

Sorry for the hassles…carry on.
VoltVisionFrenchy (aka Steve French)

Seems to me as though you may have answered your original question yourself. If the BBB does things differently and it is sufficiently confusing, a Pi may be the better platform for you :wink:

Indeed, that's why I've avoided the Pi competitors so far even though they, on paper at least, might have better capabilities.