NR no longer works on some remote machines

Now quite as bad as my other post where I thought I had killed the remote machine.

I was going through updating the machines and NR.
(Too many different versions to be nice.)

Some/most updated nicely. A few didn't.

Some which stopped loading NR were fixed by me going in and starting NR manually and setting it to auto load with:
sudo systemctl enable nodered.service

If I didn't manually start it, it didn't seem to want to load.

So after that, most of the problematic ones started to work again.

Alas now I am down to 2 or 3.
extra stuff in to maybe help.

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                  ✘   Failed to install Node.js - Exit
  Clean npm cache                     
  Install Node-RED core               
  Move global nodes to local          
  Install extra Pi nodes              
  Npm rebuild existing nodes          
  Add menu shortcut                   
  Update systemd script               
                                      

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

pi@BedPi:~/.node-red $ node-red start
-bash: node-red: command not found
pi@BedPi:~/.node-red $ 

What I could gleam from the log is that NR was already at the latest version. (shrug)

Ok. That's me stumped.

For now there are two machines with this problem.
All I did to update them was enter:

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

As said: most machines did it no problem. A couple had to be nudged and these couple are just being stubborn.

Further trials seem to indicate that I have lost the command npm too.
Using this link to upgrade NR.
https://nodered.org/docs/getting-started/upgrading
But the .node-red directory exists. It isn't like it has been uninstalled.

There is a clue for what to do in that message.

If you are meaning this part:

The following packages were automatically installed and are no longer required:
lxkeymap python-gobject python-xklavier
Use 'sudo apt autoremove' to remove them.

Well, I entered it, rebooted the machine.
Logged in (as NR still isn't loading)

pi@PortaPi:~ $ cd .node-red
pi@PortaPi:~/.node-red $ node-red start
-bash: node-red: command not found
pi@PortaPi:~/.node-red $ 

I think that happened on one of the other machines and I went through the motions.
NR complained badly about incompatible nodes - or compiled under a different version, and to rebuild...
I did that and some weird output happened.
But after that - on that machine - it worked.

This time on this machine it is being even more difficult to me.

But thanks.

As Colin said, there is a clue in the error message!
It cannot find the command node-red

Sorry, but I get that it can't find the command "node-red".

I didn't un-install it.

The other machines I did the exact same commands on work.

It is TWO machines that say NR is not installed.

If/when I run the command:

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

It starts to do things then it says/goes.....

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                  ✘   Failed to install Node.js - Exit

Looking at log I get/see:

Started : Wed 1 Aug 20:36:40 AEST 2018
Running for user pi at /home/pi
Found global nodes:   :
Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
nodejs is already the newest version (8.11.1~dfsg-2~bpo9+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Package 'nodered' is not installed, so not removed

Well, it was before I ran the command - well ORIGINALLY it was. Now all it says is it isn't installed.

I did NOT un-install it. Who did? Beats me.

Can you understand that if it was installed and I ran an UPDATE script and subsequently it says it isn't installed, then I am unable to understand what is going on or how to fix it.

The upgrade command failed installing node.js. There should be more information on that in the install log. Possibly best to post it here if you don't see anything obvious.
Also tell us what you see for the command
node -v
and
npm -v

OK, hang on.

This is in quick reply to your request:

pi@PortaPi:~/.node-red $ node -v
v8.11.1
pi@PortaPi:~/.node-red $ npm -v
-bash: npm: command not found
pi@PortaPi:~/.node-red $ 

The log:
(this is a brand new log. The existing log dated back to October last year and was a BIG file.
Do you REALLY want it?) I kept a copy of it. Just didn't want to include 8 month old information.

pi@PortaPi:~ $ cat /var/log/nodered-install.log 

***************************************

Started : Wed 1 Aug 20:44:58 AEST 2018
Running for user pi at /home/pi
Found global nodes:   :
Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
nodejs is already the newest version (8.11.1~dfsg-2~bpo9+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@PortaPi:~ $ 

Just to keep anyone interested in the loop.

I am installing npm.

sudo apt install npm

Done, now re-running update "script" for NR.

That is taking some time. But it is looking good.

First machine back up and working.

Hurray!

Waiting for results on the second one.

Second machine now up and working.
(Now the fun of updates to all the machines and their nodes.)