Error while updating to newer version of NR

Sorry...

pi@TelePi:~/.node-red $ sudo update-alternatives --config nodejs 
update-alternatives: error: no alternatives for nodejs
pi@TelePi:~/.node-red $

Shrug.

You do that on a system that actually HAS nodejs - to demonstrate what it "points to"

The point I was trying to make Andrew is, use node not nodejs

Ok.

Thanks.

I need to get the CPU load down to something more like 30% (max) as now trying to get NR to load it like watching grass grow. (But more painful)

Looking at post 14 here, any ideas what is the problem?

It isn't clear what is hogging the processor. What does, with node red running,
sudo top
show?

htop doesn't really show much.

Would sudo make a difference?

Set to also show kernel tasks

Doing it as sudo htop....

Running with jessie CPU load was down around 30%

Oh, sorry. NR is not running in either case.

Stopped.

I asked for top not htop, I understand top better. sudo may show extra processes I think.

So is the main problem that node red will not start? What happens if you just run
node-red

If that doesn't show anything useful then set the log level to trace in settings.js and try again.

Sorry...

sudo top

running node-red (from ~/.node-red....

pi@TelePi:~/.node-red $ node-red
14 Dec 20:46:54 - [info] 

Welcome to Node-RED
===================

14 Dec 20:46:55 - [info] Node-RED version: v2.1.4
14 Dec 20:46:55 - [info] Node.js  version: v14.18.1
14 Dec 20:46:55 - [info] Linux 5.10.63+ arm LE
14 Dec 20:47:08 - [info] Loading palette nodes
BAIL ON node-red-contrib-simple-message-queue/simple-queue
14 Dec 20:48:00 - [info] Dashboard version 2.26.2 started at /ui
14 Dec 20:48:04 - [warn] ------------------------------------------------------
14 Dec 20:48:04 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red
14 Dec 20:48:04 - [warn] ------------------------------------------------------
14 Dec 20:48:04 - [info] Settings file  : /home/pi/.node-red/settings.js
14 Dec 20:48:04 - [info] Context store  : 'default' [module=memory]
14 Dec 20:48:04 - [info] User directory : /home/pi/.node-red
14 Dec 20:48:04 - [warn] Projects disabled : editorTheme.projects.enabled=false
14 Dec 20:48:04 - [info] Flows file     : /home/pi/.node-red/flows.json
14 Dec 20:48:04 - [info] Creating new flow file
14 Dec 20:48:04 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

14 Dec 20:48:05 - [error] Uncaught Exception:
14 Dec 20:48:05 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:1880
    at Server.setupListenHandle [as _listen2] (net.js:1331:16)
    at listenInCluster (net.js:1379:12)
    at doListen (net.js:1516:7)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
pi@TelePi:~/.node-red $ 

Did you stop node-red service before running node-red?

node-red-stop

Ok, sorry.

Try #2.

pi@TelePi:~/.node-red $ node-red-stop
Stop Node-RED
 
Use   node-red-start   to start Node-RED again
 
pi@TelePi:~/.node-red $ node-red
14 Dec 20:52:19 - [info] 

Welcome to Node-RED
===================

14 Dec 20:52:19 - [info] Node-RED version: v2.1.4
14 Dec 20:52:19 - [info] Node.js  version: v14.18.1
14 Dec 20:52:19 - [info] Linux 5.10.63+ arm LE
14 Dec 20:52:32 - [info] Loading palette nodes
BAIL ON node-red-contrib-simple-message-queue/simple-queue
14 Dec 20:53:20 - [info] Dashboard version 2.26.2 started at /ui
14 Dec 20:53:23 - [warn] ------------------------------------------------------
14 Dec 20:53:23 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red
14 Dec 20:53:23 - [warn] ------------------------------------------------------
14 Dec 20:53:23 - [info] Settings file  : /home/pi/.node-red/settings.js
14 Dec 20:53:23 - [info] Context store  : 'default' [module=memory]
14 Dec 20:53:23 - [info] User directory : /home/pi/.node-red
14 Dec 20:53:23 - [warn] Projects disabled : editorTheme.projects.enabled=false
14 Dec 20:53:23 - [info] Flows file     : /home/pi/.node-red/flows.json
14 Dec 20:53:24 - [info] Creating new flow file
14 Dec 20:53:24 - [warn] 

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

14 Dec 20:53:24 - [info] Server now running at http://127.0.0.1:1880/
14 Dec 20:53:24 - [info] Starting flows
14 Dec 20:53:25 - [info] Started flows

Looking possible.

So what exactly is the problem? Everything looks ok to me.

Now no flow/s.

(Luckily I have backups.)

How will I load them?

Import or copy all the files to ~/.node-red?

$hit the settings file has changed.

I've for the security login (to the editor) working, but I am stuck where to define the node-red/public path.

Restore the .node-red folder from the original (except for node_modules) and run npm install. If necessary set the flows file name in settings.js

1 Like

Thanks.

Do I need to stop NR before doing that?

I'll wait as I am stuck on the settings.js file and where node-red/public/ is defined.
I can see the line in the file, but it is more like:
//httpStaticAuth: {use.....

Where as in the old one it is:

httpStatic: '/home/pi/.node-red/public/',

Oh, and got caught with the mydevicename.

Set that, but still the flows aren't being seen when NR starts.

Ok, found that problem.

Now I'm seeing this:

14 Dec 21:38:07 - [warn] Error loading credentials: SyntaxError: Unexpected token � in JSON at position 0
14 Dec 21:38:07 - [warn] Error loading flows: Error: Failed to decrypt credentials

That is a direct copy from the original backup files.

Wouldn't it be better to backup node-RED, wipe the SD card, install a fresh, clean, shiny OS, then install node-RED + backup.

OS upgrades are never as good as a fresh install.

Well.....

I've nearly done that now.

I've now been "bitten" by paho-mqtt not being installed.
And something else about MQTT. When I run the script:

pi@TelePi:~/Pimoroni/blinkt $ python3 blinkt_ctl.py 
Traceback (most recent call last):
  File "blinkt_ctl.py", line 93, in <module>
    client = mqtt.Mosquitto()
AttributeError: module 'paho.mqtt.client' has no attribute 'Mosquitto'
pi@TelePi:~/Pimoroni/blinkt $ 

So it seems (somehow) mosquitto has been removed from the install list.

Be it I have to install it now or from a brand spanking new version....

Seems I have a few other things to also get working. (Oh well. What's life without a challenge?) :wink: Just how these things happen.

NR now seems to be working. subflows, etc. All good.
Just now the things behind the scenes (like paho-mqtt and mabe mosquitto in general is/are missing)

Ok, things have .... progressed since then.

The RasPiZ(W) was pegging out its CPU load.

I tried different things and only made it worse.

It got to the stage where I couldn't connect to my WiFi.
(I've since learnt where I went wrong on that - but that is now academic.)

Here's the short story:

I broke something because I didn't start with a new flash of Buster
It was ongoing pegging out at 100% CPU for no reason I could see/find.

Suddenly I couldn't connect to my WiFi.
Cutting my losses, I flashed a new SD card with buster - direct from the web.

Went through the fun stuff, and the bit extra.

Now, at this stage, I am not going to flash/update/install it on the Z(W).
I have a 3B sitting here and I did it all on it. More memory and 3 cores.

Done. I was talking on the ethernet and knew I had to set up the WiFi.
I'll skip the boring bits.

Now the original SD card won't boot in the Z(W) or the 3b.
Just get the colour screen - so it is seeing the card and SOMETHING is happening, but it just sits there.... doing nothing.

Got the new SD card. Took it out of the 3b, plugged it into the Z(W).

Booted. Can VNC into it, can SSH into it.
Great.

Now, Couple of things to note here:
1 - I installed the image from the net. Buster - full version.
2 - node.red was NOT installed. Funny, I thought it came part and parcel.

As I was on my 3b and not this machine, all the "bookmarks" aren't available.
So I loaded the browser. "How to install node-red on raspberry pi".
Got a link. Looks like the one I sue.
Copy it, paste it and it runs.
As there is no existing node-red, it goes through fairly quickly.

All good.

I then get the old sd card and copy the files over.

flows_TelePi.json
flows_TelePi_cred.json
package.json
package-lock.json
settings.js

All good.

then ran npm install.

It went away and did it's thing.

After all this other things weren't installed and when done:

Now, NR is being difficult again.

(All from ~/.node-red directory)
ran node-red-start.
Errors after errors.
Stupid me, didn't get a screen shot.
But they were new to me. very early on and not as before.

Ok... Some nodes didn't load: or something.

npm install
command not found.
Ok, not in those exact words. But how is it that I installed node-red and ran npm install before and now npm isn't a found command?

Show us the command and the exact words please. Exact words are essential when reporting a problem, otherwise we are just guessing.