Error while updating to newer version of NR

I finally decided to update a machine with this command:
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node14

The --node14 was because it complained about node10 no longer being supported.

Then I see/get this.

Running Node-RED update for user pi at /home/pi on raspbian


This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Remove old version of Node.js       ✔   v10.17.0
head: cannot open '/tmp/node.tgz' for reading: No such file or directory
tar (child): /tmp/node.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2          
tar: Error is not recoverable: exiting now
  Install Node.js for Armv6           ✘   Bad install:  Node.js v10.17.0  Npm missing - Exit
  Add shortcut commands               
  Update systemd script               
                                      

Any errors will be logged to   /var/log/nodered-install.log

The important part (I think) is this from the log:

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodejs-legacy' is not installed, so not removed
Package 'npm' is not installed, so not removed
Package 'nodejs' is not installed, so not removed
The following package was automatically installed and is no longer required:
  libbluray2
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
cp: cannot stat '/tmp/nodejs/*': No such file or directory
rm: cannot remove '/tmp/node.tgz': No such file or directory

Versions: node:v10.17.0 npm:missing

I don't want to blindly go on and sudo apt autoremove.

I'd prefer to check before I make a bad situation worse.
:wink:

Is the time and date correct on your pi ? Have you run the normal apt-get update first to make sure the base is is up to date as well ?

Also what version of raspbian are you running?

Yes time/date is correct.

I found a link and I (seem to) have to remove/install nodejs
This is a thing that has caught many people I am seeing. (Lots of questions/threads on this)

@hardillb Stretch. Yeah, I know...

In the mean time I found this:

But that doesn't work either. :frowning:

Or I am too stupid to see what commands I need to do.

Sorry, I am 99% sure I've been here before.

(Shame on me)

But it seems strange there is no definitive instructions on how to do what I am doing.

I've searched and found a lot of people (smarter than me) having the same problem.
No, I'm not blaming others, I'm just saying.

Scenario:
The machine works. Updates are.... a long time ago.
I want to update.
I have node 10 and it is now deprecated. Fair enough.
But I can't find a black and white What to do to upgrade anywhere.

So unless people are keeping their machines up to date, and miss a few versions and then want to update/grade: they seem to be at a disadvantage as the version they have is no longer supported.

That's a different problem, they are using n which is a nodejs version manager like nvm (and NO you really shouldn't try either of those if you don't KNOW EXACTLY what you are doing)

It is very possible that the certs in stretch have expired or new certs are not present so HTTPS will just not work.

Stretch went EoL July 2020, bite the bullet and upgrade, you've already broken it

Yes, I get it.

But I think the systems shouldn't make it any worse.

I ran the command (copied from the official site on how to do it)
It complained and said I have to use the --version12,14,16 option.

Did that - maybe blindly/stupidly - and it only made things worse as it started to install then just fell apart.

So it was working - and now isn't - because the install script messed up and failed because the version was too old.
Yeah, I've also been told how to upgrade from Stretch to ... Buster.
These machines are remote and it is painful getting the SD cards and....

Doing it insitue (spelling?) would be nice.
Yes, risks are there.

Argh, it is painful being where I am with the upgrade.

Still, why aren't the command/s to update the node and nodejs to the latest versions easy to find?
(And npm?)

Sorry... I spoke a pork pie It was 8.11.1 originally.

So it would be handy if there was a clearly documented way to get NR working as it was before so I can at least have the machine as it was before.

Because the latest version nodejs might only run on the newer versions of the OS, they were released after the OS version went EoL, so you REALLY are tempting fate.

Yes the script could possibly warn you upfront if you are on a dead OS and it might fail, but it's not failing because of anything we control as far as I can see and it's a fair assumption that you are running on an OS that not (that) EoL, trying to cover all the things that could stop working because the OS isn't getting updates isn't worth the return in investment for our limited available time. What you are doing is outside the "norm"

If the remote machines are that hard to update then you really need a local copy of the deployed image you can test on first and roll back when it breaks. Especially if these are in any way mission critical.

Getting you back to where you were might not be possible especially if curl/https won't work because the certs have expired.

If you have a version in nodejs installed (v10.x) using apt-get then you could try and install the old version of node-red using npm

E.g.

npm install -g node-red@1.2.x

Where 1.2.x is what ever version you were running before.

If npm is missing you should be able to install that with apt-get as well.

Thanks.

Gonna power down and try some things.

I only have 1 monitor. :frowning:

Good news / bad news. (of course)

The update to Buster worked. (Amazing)

But when I try to start NR, I get this on the screen:

 
Starting as a systemd service.
nodered.service: Service RestartSec=20s expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 9.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=killed, status=4/ILL
nodered.service: Failed with result 'signal'.
nodered.service: Service RestartSec=20s expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 10.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=killed, status=4/ILL
nodered.service: Failed with result 'signal'.

It just keeps going.

Sorry, what is my next step?

Digging on the error I saw a reply saying that NR was incorrectly installed and doesn't need the sudo prefix.

I went back and checked. Not done. (Phew)
So that is good.

But I am not closer to understanding what is happening.

For the sake of putting more cards on the table:

This is the ownership in the ~.node-red/ directory.

pi@TelePi:~/.node-red $ ll
total 1480
drwxr-xr-x   2 pi pi    4096 Jul 15  2020 cronplusdata/
drwxr-xr-x   3 pi pi    4096 Oct  2  2017 lib/
drwxr-xr-x 253 pi pi   20480 Dec 14 13:15 node_modules/
drwxr-xr-x   6 pi pi    4096 Dec  1 21:37 public/
-rw-r--r--   1 pi pi     128 Oct 27 21:59 flows_TelePi_cred.json
-rw-r--r--   1 pi pi 1359322 Dec 13 23:53 flows_TelePi.json
-rw-r--r--   1 pi pi   14913 Dec 14 11:20 npm-debug.log
-rw-r--r--   1 pi pi    2154 Sep 25 19:13 package.json
-rw-r--r--   1 pi pi   81709 Dec 14 13:15 package-lock.json
-rw-r--r--   1 pi pi   11094 May 13  2021 settings.js

Though I don't know if the missing x is a problem. (Shrug)

And something else that may not be helping:

(After running the install script)

node -v

pi@TelePi:~/.node-red $ node -v
v14.18.1
pi@TelePi:~/.node-red $ 

So that's good.

Is nodejs missing?

sudo apt install nodejs?

from a particular directory and sudo?

Ok, now getting off topic a bit, but....

Originally the CPU load (with NR running) was anything from 10 - 30%.

Now, NR NOT running the CPU load is at 100%. Maybe down to 95%.

htop doesn't show me much, even if I show root tasks.

So I am confused what is happening.

nodejs is not a thing. it is simply node

this was a successful installation

Ok, but in other threads (and on my machines) when I do a nodejs -v I get a value.

Not the Not found error.

Node-Red won't run/start.

See post 14.
I've been down that rabbit hole and it is owned by me and not installed via/with sudo.

I ran the script
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

from ~/.node.red

Yeah, it seems to be an alternative

At a guess, older raspian os added this, newer os does not?

if you enter sudo update-alternatives --config nodejs you will see what it is pointing to.

In basic terms - use node forget about nodejs

Well, this is taken from a working machine with BUSTER.

pi@BedPi:~ $ sysinfo
Raspberry Pi 2 Model B Rev 1.1

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Raspberry Pi reference 2021-03-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 461109415073d2eb67083709662ba983cc191f14, stage5
Linux BedPi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux
pi@BedPi:~ $ nodejs -v
v12.22.1
pi@BedPi:~ $ node -v
v12.22.1
pi@BedPi:~ $ 

This is from the recently updated machine:

pi@TelePi:~ $ sysinfo
Raspberry Pi Zero W Rev 1.1

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Raspberry Pi reference 2017-09-07
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 496e41575eeb9fa13f394ffb407b7bc1d00b21c2, stage5
Linux TelePi 5.10.63+ #1496 Wed Dec 1 15:57:05 GMT 2021 armv6l GNU/Linux
pi@TelePi:~ $ nodejs -v
-bash: nodejs: command not found
pi@TelePi:~ $ node -v
v14.18.1
pi@TelePi:~ $ 

Alas just now it is painful on telepi.

After the update, CPU maxed out at 95 - 100% all the time.

But (I have been chasing this since .... 09:00 today) and there are .... a lot of closed tabs in the history.

But reading recent posts on getting NR working, nodejs -v was mentioned quite a few times.

I can only compare one machine to the other.
But as I just also said: the new machine is pretty much maxed out CPU load. :frowning: