-
• #2
@tom.gidden do you have any ideas about this? (Tom originally added the code for running the hub as a service - personally I still tend to run it so the Pi boots up and displays it on the screen)
-
• #3
I should say that I had to modify the installation process a bit because the node-red installation script didn't work because the command: sudo npm, didn't work. So I had to install it with:
npm install -g node-red
and then use pm2 to autostart node-red because the "node-red-start" service didn't work either, probably because of the installation path.
Linux makes me mad sometimes. -
• #4
That's odd - what did
sudo npm
say?It definitely works on the Pi I have here, but I haven't updated the OS in a month or two. Things get changed all the time and it's a constant battle to keep documentation up to date :(
-
• #5
Hi,
Well, from the error log it looks like this line of the script is failing:sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
readlink
isn't getting a parameter, and so is returning nothing; and sosetcap
is missing that parameter too. The most likely answer to this is thatwhich node
is failing, ie.node
can't be found.Since you say
start.sh
run manually is working, I'd say that it's not thatnode
(andnpm
, since you're having trouble with that too) isn't installed at all, but that it's not in the path for the user under whichnode-red
is being run. That'd imply a slightly non-standard installation of Node, at least as far as the assumptions of this script are concerned (...or perhaps we've been using a non-standard Node!)Did you start with a Raspbian that has Node and Node-RED preinstalled? If not, I'd start by redoing the installation of Node. If so, maybe there's a problem with our script and that
start.sh
should be a little more aggressive about finding it, rather than just assuming it's in$PATH
.Please can you try:
which node
whereis node
nave ls
(might fail) -
• #6
Thanks! Just a thought but you could try installing the
nodejs-legacy
package? I seem to remember on some OSes you need that as the default node.js executable changed name tonode.js
? -
• #7
In later it is installed as
nodejs
and there is package that does a symbolic link tonode
- the legacy one you mention. -
• #8
Hmm. Okay, I'll try to take a look at this when I next get a chance, if no-one else gets there first: a fresh install of Raspbian without my usual install.
-
• #9
Thanks for the explanation @tom.gidden and you perfectly correct, my nodejs installation is non-standard.
My base is Hassbian (Rasbian with Home Assistant and some other stuff thrown in), but then I used "n-installer" to install the latest version of node and the path to Node and NPM is some thing like "home/pi/n/...", can't check it exackly right now.
The reason for doing it like that? Well mostly because Google told me it was an easy way I think and I needed a newer version of node then the one pre-installed. I didn't install Nodejs for Node-Red but for a bridge between smartthings and Home Assistant.I going to try to have PM2 start EspruinoHub instead, as I do with Node-Red right now, but if I can't get that to work I guess I have to remove and reinstall node, npm and node-red!
-
• #10
If I remember correctly, Node-RED actually needs an old version of Node at the moment.. well, not older as such, but I think it only runs on Node 6.x (the long-term stable release), rather than the state-of-the-art Node 7.x. As a result, it doesn't support Promises and a host of other ES6 features.
One option is to use
nave
, which lets you have several versions of Node installed and switch between them as needed. That way, you can have Node-RED and EspruinoHub running in Node 6.x, and use another version for other scripts. Or, as you say, just reinstall with Node 6.x: most code should work with it.My version of
EspruinoHub.service
is substantially different as I don't use standard Node either: I install the base server version of Raspbian and do a custom install of Node into its own user.
Hello
I trying to get the EspruinoHub.service to autostart by following the instructions on the Github page. But when i run the command I get this:
I can run the start.sh file normally by
and everyhting works as promised but I just can't get the systemdb to work.
Any ideas?
Edit: EspruinoHub is installed in /home/pi/EspruinoHub.