RasPi now locks up on NR after updating NR

I decided to go through and update some machines.

Looking at the load: NR is 99% CPU load.

Stopping it and starting it again I don't see anything in the output from the CLI.

This is what I see when I start NR.

pi@MusicPi:~/.node-red $ node-red-start

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.0.82:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
Started Node-RED graphical event wiring tool.
31 Aug 16:15:16 - [info]
Welcome to Node-RED
===================
31 Aug 16:15:16 - [info] Node-RED version: v0.20.7
31 Aug 16:15:16 - [info] Node.js  version: v8.16.0
31 Aug 16:15:16 - [info] Linux 4.9.56-v7+ arm LE
31 Aug 16:15:17 - [info] Loading palette nodes
31 Aug 16:15:21 - [info] Dashboard version 2.16.2 started at /ui
31 Aug 16:15:22 - [info] Settings file  : /home/pi/.node-red/settings.js
31 Aug 16:15:22 - [info] Context store  : 'default' [module=memory]
31 Aug 16:15:22 - [info] User directory : /home/pi/.node-red
31 Aug 16:15:22 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
31 Aug 16:15:22 - [info] Flows file     : /home/pi/.node-red/flows_MusicPi.json
31 Aug 16:15:22 - [info] Server now running at http://127.0.0.1:1880/
31 Aug 16:15:22 - [info] Starting flows
31 Aug 16:15:23 - [info] Started flows
31 Aug 16:15:23 - [info] [mqtt-broker:M....

(Sorry I moved the mouse when copying the text)

So all is good.

Looking at it from another CLI I see this:

pi@MusicPi:~ $ systemctl status nodered.service
● nodered.service - Node-RED graphical event wiring tool
   Loaded: loaded (/lib/systemd/system/nodered.service; enabled)
   Active: active (running) since Sat 2019-08-31 16:15:14 AEST; 2min 5s ago
     Docs: http://nodered.org/docs/hardware/raspberrypi.html
 Main PID: 3486 (node-red)
   CGroup: /system.slice/nodered.service
           ├─3486 node-red
           ├─3522 /bin/bash /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware/nrgpio pwm 7 100
           ├─3524 python -u /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware/nrgpio.py pwm 7 100
           ├─3525 /bin/bash /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware/nrgpio out 15 100
           ├─3527 python -u /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware/nrgpio.py out 15 100
           ├─3528 /bin/bash /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware/nrgpio out 11 100
           └─3530 python -u /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/hardware/nrgpio.py out 11 100
pi@MusicPi:~ 

All looks good.

But I can't load NR in a browser.

Disabling it with sudo systemctl disable nodered.service and rebooting:

This is what happens:

pi@MusicPi:~ $ sudo systemctl status nodered.service
● nodered.service - Node-RED graphical event wiring tool
   Loaded: loaded (/lib/systemd/system/nodered.service; disabled)
   Active: inactive (dead)
     Docs: http://nodered.org/docs/hardware/raspberrypi.html
pi@MusicPi:~ $ cd .node-red
pi@MusicPi:~/.node-red $ node-red --safe
31 Aug 16:26:50 - [info] 

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

31 Aug 16:26:50 - [info] Node-RED version: v0.20.7
31 Aug 16:26:50 - [info] Node.js  version: v8.16.0
31 Aug 16:26:50 - [info] Linux 4.9.56-v7+ arm LE
31 Aug 16:26:51 - [info] Loading palette nodes
31 Aug 16:26:57 - [info] Dashboard version 2.16.2 started at /ui
31 Aug 16:26:59 - [info] Settings file  : /home/pi/.node-red/settings.js
31 Aug 16:26:59 - [info] Context store  : 'default' [module=memory]
31 Aug 16:26:59 - [info] User directory : /home/pi/.node-red
31 Aug 16:26:59 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
31 Aug 16:26:59 - [info] Flows file     : /home/pi/.node-red/flows_MusicPi.json
31 Aug 16:26:59 - [info] Server now running at http://127.0.0.1:1880/
31 Aug 16:26:59 - [info] *****************************************************************
31 Aug 16:26:59 - [info] Flows stopped in safe mode. Deploy to start.
31 Aug 16:26:59 - [info] *****************************************************************

I can then view NR in a browser.

Now, as said before, I can get away with one DEPLOY then it just locks up.

Thoughts?
(This is one of the machines. There are two not playing. I'm leaving the other one well enough alone at this time.)

Ok, more information:

First DEPLOY, then second.

This is what I see from the CLI:
(Picture.) I think one more line is there. Nothing else.
top shows the load.

How did you update NR ?

I was told this is the command.

sudo npm install -g --unsafe-perm node-red

The documentation says:

The script can also be used to upgrade an existing install when a new release is available.

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

For 100% clarity, that is run from the .node-red directory too - yes?
No sudo either.

No sudo. It will install it automatically in the correct homedir.

   # this script assumes that $HOME is the folder of the user that runs node-red
   # that $USER is the user name and the group name to use when running is the
   # primary group of that user

Ok.

Wierd.

I tried the command as show from ~ on said Pi.

Didn't like it.

I cd .node-red then did it. All good.
Which is why I asked.
Thoughts?

You are logged in as the same user ? No thoughts. Did you previously install it under sudo/root ?

Yes, logged in as pi.

Previously . . . . . can't say.

But when I cd .node-red and ran it: all seems good.

Once things get back to the prompt I will see if I can post the CLI log.

(Hurray! Still in scroll back)

pi@PIFACE:~ $ sudo bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
bash: /dev/fd/63: No such file or directory
pi@PIFACE:~ $ cd .node-red
pi@PIFACE:~/.node-red $ bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

 
This script will remove versions of Node.js prior to version 7.x, and Node-RED and
if necessary replace them with Node.js 10.x LTS (dubnium) and the latest Node-RED from Npm.
 
It also moves any Node-RED nodes that are globally installed into your user
~/.node-red/node_modules directory, and adds them to your package.json, so that
you can manage them with the palette manager.
 
It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.
 
To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.
 
Are you really sure you want to do this ? [y/N] ? y


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

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       ✔
  Update Node.js LTS                  ✔   Node v6.17.1   Npm 3.10.10
  Clean npm cache                     ✔
  Install Node-RED core               ✔   0.20.7 
  Move global nodes to local          -
  Install extra Pi nodes              -
  Npm rebuild existing nodes          -
  Add shortcut commands               ✔
  Update systemd script               ✔
                                           

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

All done.
  You can now start Node-RED with the command  node-red-start
  or using the icon under   Menu / Programming / Node-RED
  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started  Saturday 31 August  16:51:10 AEST 2019  -  Finished  Saturday 31 August  17:00:15 AEST 2019

pi@PIFACE:~/.node-red $ 

Ah.

Ok. I sudo it at the first time.

I take it that this command is supposed to update the node thing.

I see it listed but after doing the command a few times on the machine it is still version

pi@PIFACE:~ $ node -v
v6.17.1
pi@PIFACE:~ $ 

What does

more /etc/apt/sources.list.d/nodesource.list
apt-cache policy nodejs

say ?

Refer to this topic

(I'm in the poo now....)

This is what I get:

pi@PIFACE:~ $ more /etc/apt/sources.list.d/nodesource.list
deb https://deb.nodesource.com/node_6.x jessie main
deb-src https://deb.nodesource.com/node_6.x jessie main
pi@PIFACE:~ $ 

Jessie is a bit old.
Seems I may have to update it to Stretch in the near future.
But can node (version 8) work on Jessie?

As was suggested in that topic:

rm /etc/apt/sources.list.d/nodesource.list
apt-get purge nodejs
sudo apt-get update

Then run the bash script again.

(Ok, did that.)

Why not also sudo apt upgrade as well?

Anyway: that wasn't done.

I think this could be the next problem:

While installing NR from the command I was told to use.

  Install Node.js LTS                 ✘   Failed to install Node.js - Exit

The log file (tail) shows:

pi@PIFACE:~ $ tail -80 /var/log/nodered-install.log 
Get:18 https://dl.bintray.com stable/etcher armhf Packages
Get:19 https://dl.bintray.com stable/etcher Translation-en_AU
Get:20 https://dl.bintray.com stable/etcher Translation-en
Ign http://repo.mosquitto.org jessie/main Translation-en_AU
Get:21 https://dl.bintray.com stable/etcher armhf Packages
Err https://dl.bintray.com stable/etcher armhf Packages
  HttpError404
Hit http://archive.raspberrypi.org jessie/main armhf Packages
Ign http://repo.mosquitto.org jessie/main Translation-en
Get:22 https://dl.bintray.com stable/etcher Translation-en_AU
Ign https://dl.bintray.com stable/etcher Translation-en_AU
Ign http://q4os.org q4os-rpi-firefox-cn/main Translation-en_AU
Get:23 https://dl.bintray.com stable/etcher Translation-en
Ign https://dl.bintray.com stable/etcher Translation-en
Hit http://archive.raspberrypi.org jessie/ui armhf Packages
Ign http://q4os.org q4os-rpi-firefox-cn/main Translation-en
Hit http://apt.rb24.com jessie/main armhf Packages
Ign http://apt.rb24.com jessie/main Translation-en_AU
Ign http://apt.rb24.com jessie/main Translation-en
Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
Hit http://mirrordirector.raspbian.org jessie/contrib armhf Packages
Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages
Hit http://mirrordirector.raspbian.org jessie/rpi armhf Packages
Ign http://archive.raspberrypi.org jessie/main Translation-en_AU
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_AU
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Ign http://linux.teamviewer.com stable/main Translation-en_AU
Ign http://linux.teamviewer.com stable/main Translation-en
Ign http://linux.teamviewer.com preview/main Translation-en_AU
Ign http://linux.teamviewer.com preview/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_AU
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_AU
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_AU
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_AU
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 42.8 kB in 32s (1,332 B/s)
W: GPG error: http://repo.mosquitto.org jessie InRelease: The following signatures were invalid: KEYEXPIRED 1515017477 KEYEXPIRED 1515017477 KEYEXPIRED 1515017477
W: GPG error: http://apt.rb24.com jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F2A8428D3C354953
W: Failed to fetch http://mirrors.digitalocean.com/debian/dists/jessie-backports/main/binary-armhf/Packages  404  Not Found [IP: 104.24.116.209 80]

W: Failed to fetch https://dl.bintray.com/resin-io/debian/dists/stable/etcher/binary-armhf/Packages  HttpError404

E: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting

WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  pix-icons pix-plym-splash pixel-wallpaper
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libv8-3.14.5
The following NEW packages will be installed:
  libv8-3.14.5 nodejs
0 upgraded, 2 newly installed, 0 to remove and 95 not upgraded.
Need to get 1,701 kB of archives.
After this operation, 6,327 kB of additional disk space will be used.
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libv8-3.14.5 armhf 3.14.5.8-8.1+rpi1 [1,088 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main nodejs armhf 0.10.29~dfsg-2 [614 kB]
Fetched 1,701 kB in 1s (876 kB/s)
Selecting previously unselected package libv8-3.14.5.
(Reading database ... 185932 files and directories currently installed.)
Preparing to unpack .../libv8-3.14.5_3.14.5.8-8.1+rpi1_armhf.deb ...
Unpacking libv8-3.14.5 (3.14.5.8-8.1+rpi1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_0.10.29~dfsg-2_armhf.deb ...
Unpacking nodejs (0.10.29~dfsg-2) ...
Processing triggers for man-db (2.7.5-1~bpo8+1) ...
Setting up libv8-3.14.5 (3.14.5.8-8.1+rpi1) ...
Setting up nodejs (0.10.29~dfsg-2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.19-18+deb8u10) ...
sudo: npm: command not found
pi@PIFACE:~ $ 

What happens when you install npm

sudo apt-get install npm

Wow! That is doing something.

lots of stuff being installed.

Last bit of what happened.

Setting up node-mute-stream (0.0.4-1) ...
Setting up node-normalize-package-data (0.2.2-1) ...
Setting up node-read (1.0.5-1) ...
Setting up node-read-package-json (1.2.4-1) ...
Setting up node-retry (0.6.0-1) ...
Setting up node-sha (1.2.3-1) ...
Setting up node-slide (1.1.4-1) ...
Setting up npm (1.4.21+ds-2) ...
pi@PIFACE:~ $ node -v
-bash: node: command not found
pi@PIFACE:~ $ sudo reboot
Connection to piface closed by remote host.
Connection to piface closed.
me@me-desktop:~$ 

You need to sort all those problems with your repositories. Get the following to work without error then you can run the script again. The problem with your repositories is not to do with node red.
sudo apt update && sudo apt full-upgrade
Or install Buster on the pi and start again.

Thanks.

I may have to think of that.

Or at lest update to Stretch.

Buster works fine for me with node-red. You might like this
Configure your Pi (Zero upwards) as a headless server (Buster)