A Brighter Node Red

Just today  – an upgrade notice for Node-Red appeared in my in-box. Upgrade details are here.

What is Node-Red?  Details here – if you’re not using it or at least investigating it – you may be missing out.

Now, the support guys (Google groups here) are VERY clear about required versions of NPN etc. so I suggest you read that update page carefully.  Because I had 2 identical machines (NanoPi M1 as it happens) I thought I’d go for broke. Don’t copy me unless you have a reliable, easy to get to backup – it may well go wrong (mine didn’t) and you’ll be on your own for not precisely following the instructions.

sudo npm cache clean
sudo npm update -g –unsafe-perm node-red

I had already installed the latest (previous Node-Red – maybe a couple of weeks old) – not the default Raspberry Pi version but a manually installed version – along with NPM and the latest NODE and that is NOT what they recommend. I turned Node-Red off (node-red-stop) and used the above commands as PI user (I know, not on a Raspberry Pi but to make my life easy I always make a PI user who belongs to all the PI groups including SUDO)  – I then turned Node-Red on (node-red-start).

Voila. It worked first time.  0.14.0

Now – so what’s special – well, one of my issues with Node-Red has been initialisation of variables – sometimes a global variable can get used before it has been defined!!

The team told me a while ago that the LEFT-MOST tab gets run first – of course that’s no good if your inits are not in the left most tab (I have a tab called “init”). Well now it is because you can SLIDE the tab order about with the mouse – how neat is that!

The DEBUG panel now lets you see message from all over – or just the current tab – which is nice and there are some new nodes and other improvements – I’ll let you read all about them here. The big one that stands out is the LINK node. I HATE making large tabs that are really complicated – but to split them up involves passing messages between tabs – and until now that had to be done the hard way – by global variables (not ideal as you have to poll them) or MQTT or similar. Well now there is a node for THAT as well.

Then I spotted a bug – the exec function would no longer take numbers as arguments – only strings (which is what you’d expect but it had always accepted numbers).  I reported this early evening. Meanwhile someone reported an issue with MQTT…  so the guys amazingly quickly fixed all this.

sudo npm cache clean
sudo npm update -g –unsafe-perm node-red

Erm, no – this time no messages, just accepted my commands but no update.  It was a bit late to expect answers out of anyone… so KNOWING I HAD A BACKUP and stopping Node-Red first then restarting afterwards…

sudo npm cache clean
sudo npm install -g –unsafe-perm node-red

Worked a TREAT – I’m now sitting on version 0.14.3 with all my flows intact. The exec issue has gone away and here we are the next morning, after a few more checks I’ll progress with updating my other installations.

The team are to be congratulated on the work they’ve done on this tool – it costs us nothing but opens up entirely new possibilities to both beginners and seasoned programmers.  Very different image of IBM to the one I had when I was a kid (huge buildings, everyone talking in abbreviations, obscenely expensive leased servers) – at least that’s what I remember  – probably wrong Smile

Marvellous.

Facebooktwitterpinterestlinkedin

22 thoughts on “A Brighter Node Red

  1. Hi Peter, I wanted to ask if there is any node-red flow (code) that let me add dynamically more sensors.
    In that way. i.e. rpi3/sensor/temp1 then when I add a new one rpi3/sensor/temp2 shows up in mynode-red/ui display page the new sensor without modifying the flow every time I add a new sensor.
    Thanks a lot in advance

  2. Anyone having trouble with the node edit tray? Firefox needs to be maxed to edit all the fields. BigTimer’s long dialog is one. I should have waited a bit 🙂

  3. Still struggling to get later version of Node_red running. Followed instructions here:
    http://nodered.org/docs/hardware/raspberrypi

    Uninstalled preinstalled version then tried to install new but node-red fails to start with:
    Failed at step USER spawning /usr/bin/env: No such process

    Also npm -v fails with “Inllegal Instruction”
    I then tried:
    wget http://node-arm.herokuapp.com/node_latest_armhf.deb
    sudo dpkg -i node_latest_armhf.deb

    That didn’t fix my issue. I don’t like to just “reinstall” but I’m thinking that may be the better option here.

    I know you’ve come accross this in the past just wondered if you had any suggestions.

    Enjoy the blog by the way, great job.

      1. Thanks Pete, I think that changed NodeJS 4 to 5 which and now I’m informed that:
        /usr/bin/env: node-red-pi: No such file or directory

        Followed that red-herring for a bit, tried to create symlink and install nodejs-legacy, later fails with failed dependencies.

        Think I’ll just start from scratch, was trying to preserve configurations done to date.

        Thanks for the script, useful.

        1. Gary, I had problems with my first node-red install, uninstalled everything and started from scratch following the Manual Install instruction at http://nodered.org/docs/hardware/raspberrypi
          Worked good after that.

          Oh, and one time I downloaded the v6.x.x development version of nodeJS, which ran but threw errors. Another user told me the LTS v4.x.x is the safer option, so I uninstalled v6 and sure enough v4 ran with no errors on my Pi. The Manual Install instructions install v4.

          1. Thanks Kris, I think you’re right, looks like a fresh install with no “over excited” jumping through the instructions.

            I did have it all setup but woke one morning to silence and realised I’d lost it all through an SD crash.

            Will be following Pete’s path of regular backups and simple setup script as worst case fallback.

  4. Kris – yes, I was up late last night updating… by midnight I had 0.14.3 and I can confirm the exec node works – left everything running overnight and all is well. This morning I’m going to chance updating other systems. Looking good.

  5. It should also be noted that move tabs doesn;t work in chrome, but does in firefox.

    1. Erm, Paul – the move tabs work a treat on my Chrome…. Windows 10 64 bit – reasonably up to date chrome…

      1. Ok, Went to chrome and checked for update. I now have Version 51.0.2704.103 m (64-bit) and it does work.

        P.

        1. Great – well, others in here might want to take note of this – older chrome might be an issue – thanks Paul.

    1. Thanks Vincent – for reasons beyond me – When copy/pasting from some sites to Microsoft Writer, just occasionally I get something that looks exactly right in the editor – and fails miserably on the final page – it was way too late last night to check. Hopefully now sorted.

Comments are closed.