Cannot update Node-Red v1.0.6

Just checked my installation, which has been working uninterrupted for quite some time now and realized it's out of date, so I run sudo npm install -g --unsafe-perm node-red with result:

npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/home/adam/.npm-global/bin/node-red -> /home/adam/.npm-global/lib/node_modules/node-red/red.js
/home/adam/.npm-global/bin/node-red-pi -> /home/adam/.npm-global/lib/node_modules/node-red/bin/node-red-pi
+ node-red@1.2.1
updated 1 package in 35.563s

Then service node-red restart and check, my Node-Red is still v1.0.6, reboot the PC and... still v1.0.6
Any thoughts?

What hardware/os are you running on and how did you install node-red? I don't recognise the .npm-global path there.

Stop the service and start node-red in a terminal. Post the output you get here please. Use the </> button at the top of the forum text window when pasting it in.

Further to my previous post I think I see the problem. Somehow (either intentionally or not) npm has been configured to install global nodes into the .npm-global folder under /home/adam. So when you install node-red it is going into that folder. I suspect that your service is using a different set of global nodes installed in the system location, which is where the original node-red is installed.

Here is an output from command line start:

17 Oct 17:32:54 - [info]

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

17 Oct 17:32:54 - [info] Node-RED version: v1.0.6
17 Oct 17:32:54 - [info] Node.js  version: v10.22.1
17 Oct 17:32:54 - [info] Linux 4.15.0-121-generic x64 LE
17 Oct 17:32:54 - [info] Loading palette nodes
17 Oct 17:32:56 - [info] Dashboard version 2.23.4 started at /ui
17 Oct 17:32:56 - [info] Settings file  : /home/adam/.node-red/settings.js
17 Oct 17:32:56 - [info] Context store  : 'default' [module=localfilesystem]
17 Oct 17:32:56 - [info] User directory : /home/adam/.node-red
17 Oct 17:32:56 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 Oct 17:32:56 - [info] Flows file     : /home/adam/.node-red/flows_linux-pc.js                                                                                                                                                             on
17 Oct 17:32:56 - [info] Server now running at http://127.0.0.1:1880/
17 Oct 17:32:56 - [warn]

I use NodeRed since early days, it's the only NodeJS service I have on my PC, already had problems, prior NodeRed v1 with my installation, I completely removed everything and installed using sudo npm install -g --unsafe-perm node-red
I think, I did few upgrades since, always assumed everything went okay.

Go into your .node-red folder and post the output from
npm list -g node-red
and
npm list node-red

What OS are you running on? I think I asked that before.

Also what command are you using to start node-red from the command line?

Re: 1.

 npm list -g node-red
/home/adam/.npm-global/lib
└── node-red@1.2.1

Re.2:

npm list node-red
node-red-project@0.0.1 /home/adam/.node-red
└── (empty)

Re.3 (command to start Node-Red instead of service):

node-red

Edit - Re.4:
Ubuntu 18.04.5 LTS on x64 architecture

So as I thought, it is being installed to the wrong directory. There is something unusual about your npm setup so that global nodes are going in the wrong place. I don't know why that might be.
If no-one else knows the reason then I can only suggest that you purge npm and nodejs
sudo apt purge npm
sudo apt purge nodejs
And then reinstall using the recommended node red install script for Debian/Ubuntu/rasbian from the node red docs. If you go to the getting started guide and follow the links for installing on a pi then you will find it.

I run script from Node-Red website:

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

then I have following result when I try node-red-start:

node-red-start

Node-RED is not yet fully installed. Please re-run the install script again manually.

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

then retry  node-red-start

Now it doesn't work at all :expressionless:

Post the node red install log please. The one generated by the script. It tells you where it is at the end.

Here they are (I tried to install it few times as the error message suggested):


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

Started : Sat 17 Oct 22:24:12 BST 2020
Running for user adam at /home/adam
Found global nodes:   :

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

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
Already have nodejs v10.22.1
Now install nodejs
Versions: node:v10.22.1 npm:6.14.6
Now install Node-RED
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/home/adam/.npm-global/bin/node-red -> /home/adam/.npm-global/lib/node_modules/node-red/red.js
/home/adam/.npm-global/bin/node-red-pi -> /home/adam/.npm-global/lib/node_modules/node-red/bin/node-red-pi
+ node-red@1.2.1
updated 1 package in 16.477s
1.2.1 
Now create basic package.json for the user and move any global nodes
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for adam
Now add launcher to top bar, add cpu temp example, make sure ping works
Memory : 11G
Finished : Sat 17 Oct 22:24:12 BST 2020

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

Started : Sat 17 Oct 22:26:16 BST 2020
Running for user adam at /home/adam
Found global nodes:   :

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

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
Already have nodejs v10.22.1
Now install nodejs
Versions: node:v10.22.1 npm:6.14.6
Now install Node-RED
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/home/adam/.npm-global/bin/node-red-pi -> /home/adam/.npm-global/lib/node_modules/node-red/bin/node-red-pi
/home/adam/.npm-global/bin/node-red -> /home/adam/.npm-global/lib/node_modules/node-red/red.js
+ node-red@1.2.1
updated 1 package in 10.384s
1.2.1 
Now create basic package.json for the user and move any global nodes
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for adam
Now add launcher to top bar, add cpu temp example, make sure ping works
Memory : 11G
Finished : Sat 17 Oct 22:26:16 BST 2020

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

Started : Sat 17 Oct 22:30:56 BST 2020
Running for user adam at /home/adam
Found global nodes:   :

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

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
Now install nodejs
Updating nodejs 
Using nodesource.list
Removing nodejs v0

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

Reading package lists...
Building dependency tree...
Reading state information...
Package 'npm' is not installed, so not removed
Package 'nodejs' is not installed, so not removed
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

## Installing the NodeSource Node.js 12.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://archive.canonical.com/ubuntu bionic InRelease
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease [20.8 kB]
Get:5 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:6 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Hit:7 https://artifacts.elastic.co/packages/6.x/apt stable InRelease
Hit:8 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:9 https://deb.nodesource.com/node_10.x bionic InRelease
Get:10 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main i386 Packages [79.5 kB]
Get:11 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages [79.4 kB]
Get:12 http://gb.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [295 kB]
Get:13 http://gb.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [286 kB]
Get:14 http://gb.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:15 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [48.9 kB]
Get:16 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [57.1 kB]
Get:17 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:18 http://gb.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [9,288 B]
Fetched 1,133 kB in 2s (507 kB/s)
Reading package lists...

## Confirming "bionic" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_12.x/dists/bionic/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
Warning: apt-key output should not be parsed (stdout is not a terminal)
OK

## Creating apt sources list file for the NodeSource Node.js 12.x repo...

+ echo 'deb https://deb.nodesource.com/node_12.x bionic main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_12.x bionic main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Hit:1 http://archive.canonical.com/ubuntu bionic InRelease
Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:4 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:6 https://artifacts.elastic.co/packages/6.x/apt stable InRelease
Get:7 https://deb.nodesource.com/node_12.x bionic InRelease [4,584 B]
Hit:8 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:9 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:10 https://deb.nodesource.com/node_12.x bionic/main amd64 Packages [765 B]
Fetched 5,349 B in 2s (2,495 B/s)
Reading package lists...

## Run `sudo apt-get install -y nodejs` to install Node.js 12.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
     echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn



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

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed
  nodejs
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 18.4 MB of archives.
After this operation, 94.0 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_12.x bionic/main amd64 nodejs amd64 12.19.0-1nodesource1 [18.4 MB]
Fetched 18.4 MB in 2s (11.5 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 316112 files and directories currently installed.)
Preparing to unpack .../nodejs_12.19.0-1nodesource1_amd64.deb ...
Unpacking nodejs (12.19.0-1nodesource1) ...
Setting up nodejs (12.19.0-1nodesource1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Versions: node:v12.19.0 npm:6.14.8
Now install Node-RED
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/home/adam/.npm-global/bin/node-red -> /home/adam/.npm-global/lib/node_modules/node-red/red.js
/home/adam/.npm-global/bin/node-red-pi -> /home/adam/.npm-global/lib/node_modules/node-red/bin/node-red-pi
+ node-red@1.2.1
updated 1 package in 13.854s
1.2.1 
Now create basic package.json for the user and move any global nodes
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for adam
Now add launcher to top bar, add cpu temp example, make sure ping works
Memory : 11G
Finished : Sat 17 Oct 22:30:56 BST 2020

Just removed nodejs and npm, manually removed any nodered and nodejs relations form home and local/lib and re-started installation with the same result

As you can see, node red is still being installed to .npm-global for some reason, so there is something wing with your npm config. I don't know what that might be. Google suggests the global location can be set by an environment variable or possibly by an npm config option. Something you have done previously, or something you have installed, must be causing that. Have a look at your environment variables and see if there is anything npm related and delete your .npm folder.

[Edit] Have you possibly installed nvm or n or followed the advice here: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory

@Colin if think, you're right, I just checked my .profile file and there is export PATH=~/.npm-global/bin:$PATH Do I just delete this line and apt purge nodejs with all the remaining folders, or is there anything else I need to do to roll it back to "normal"?
Last night (my time) was getting too late and I started NodeRED flows on Docker. I'll try to sort this again tonight. I don't think I have nvm installed, how do I check it?
Thank you for all your help, I'll post the reply whether I sorted this or not.

I think if you delete that line, reboot, and run the install script again that should be all you need to do. No need to uninstall nodejs.
If it still doesn't work then post the install log again.

Oh, delete the .npm-global folder too, it shouldn't matter but probably a good idea to avoid confusion in the first place.

Deleted the line, uninstalled (purge) nodejs and npm, deleted .npm-global folder and rebooted before I tried to install with the script, still doesn't work, log:


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

Started : Sun 18 Oct 20:18:48 BST 2020
Running for user adam at /home/adam
Found global nodes:   :

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

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
Now install nodejs
Updating nodejs 
Using nodesource.list
Removing nodejs v0

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

Reading package lists...
Building dependency tree...
Reading state information...
Package 'npm' is not installed, so not removed
Package 'nodejs' is not installed, so not removed
0 to upgrade, 0 to newly install, 0 to remove and 17 not to upgrade.

## Installing the NodeSource Node.js 12.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:4 http://archive.canonical.com/ubuntu bionic InRelease
Get:5 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Hit:6 https://deb.nodesource.com/node_12.x bionic InRelease
Get:7 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:8 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Get:9 http://gb.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [295 kB]
Get:10 http://gb.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [286 kB]
Get:11 http://gb.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:12 http://gb.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [9,288 B]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [48.9 kB]
Get:14 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [57.1 kB]
Get:15 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Fetched 953 kB in 3s (376 kB/s)
Reading package lists...

## Confirming "bionic" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_12.x/dists/bionic/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
Warning: apt-key output should not be parsed (stdout is not a terminal)
OK

## Creating apt sources list file for the NodeSource Node.js 12.x repo...

+ echo 'deb https://deb.nodesource.com/node_12.x bionic main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_12.x bionic main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Hit:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:2 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:4 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 https://deb.nodesource.com/node_12.x bionic InRelease
Hit:6 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:7 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:8 http://archive.canonical.com/ubuntu bionic InRelease
Reading package lists...

## Run `sudo apt-get install -y nodejs` to install Node.js 12.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
     echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn



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

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed
  nodejs
0 to upgrade, 1 to newly install, 0 to remove and 17 not to upgrade.
Need to get 18.4 MB of archives.
After this operation, 94.0 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_12.x bionic/main amd64 nodejs amd64 12.19.0-1nodesource1 [18.4 MB]
Fetched 18.4 MB in 2s (12.3 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 316112 files and directories currently installed.)
Preparing to unpack .../nodejs_12.19.0-1nodesource1_amd64.deb ...
Unpacking nodejs (12.19.0-1nodesource1) ...
Setting up nodejs (12.19.0-1nodesource1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Versions: node:v12.19.0 npm:6.14.8
Now install Node-RED
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/home/adam/.npm-global/bin/node-red-pi -> /home/adam/.npm-global/lib/node_modules/node-red/bin/node-red-pi
/home/adam/.npm-global/bin/node-red -> /home/adam/.npm-global/lib/node_modules/node-red/red.js

> bcrypt@3.0.6 install /home/adam/.npm-global/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v72-linux-x64-glibc.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@12.19.0 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/home/adam/.npm-global/lib/node_modules/node-red/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
  SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
  COPY Release/bcrypt_lib.node
  COPY /home/adam/.npm-global/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/adam/.npm-global/lib/node_modules/node-red/node_modules/bcrypt/build'

> bcrypt@3.0.8 install /home/adam/.npm-global/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
[bcrypt] Success: "/home/adam/.npm-global/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
+ node-red@1.2.1
added 359 packages from 320 contributors in 35.085s
1.2.1 
Now create basic package.json for the user and move any global nodes
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for adam
Now add launcher to top bar, add cpu temp example, make sure ping works
Memory : 11G
Finished : Sun 18 Oct 20:18:48 BST 2020

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

Started : Sun 18 Oct 20:21:41 BST 2020
Running for user adam at /home/adam
Found global nodes:   :

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

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
Already have nodejs v12.19.0
Now install nodejs
Versions: node:v12.19.0 npm:6.14.8
Now install Node-RED
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/home/adam/.npm-global/bin/node-red-pi -> /home/adam/.npm-global/lib/node_modules/node-red/bin/node-red-pi
/home/adam/.npm-global/bin/node-red -> /home/adam/.npm-global/lib/node_modules/node-red/red.js
+ node-red@1.2.1
updated 1 package in 10.209s
1.2.1 
Now create basic package.json for the user and move any global nodes
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for adam
Now add launcher to top bar, add cpu temp example, make sure ping works
Memory : 11G
Finished : Sun 18 Oct 20:21:41 BST 2020

It is still installing in the wrong place. Do you not remember what else you may have done?

What do
echo $PATH
npm config list
show?
Also
cat ~/.npmrc

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.8 node/v12.19.0 linux x64"

; userconfig /home/adam/.npmrc
prefix = "/home/adam/.npm-global"
update-notifier = false

; node bin location = /usr/bin/node
; cwd = /home/adam
; HOME = /home/adam
; "npm config ls -l" to show all defaults.
cat ~/.npmrc
prefix=/home/adam/.npm-global
update-notifier=false

Did you look at those and see what is (probably) the problem and try to work out what to do about it?

As you can see both have prefix = "/home/adam/.npm-global" which I imagine is the problem. Looking at the npm docs (which is where I found the npm config list command I think what you need to do is to get rid of the prefix config which, I assume, will then revert to the default. So try
npm config delete prefix
Then run npm config list again and check it has gone. I am not sure about the relationship between that and .npmrc so then have a look at that and see if the prefix line has gone. If it hasn't then delete it.
Close the terminal down and reopen it, in fact maybe reboot just to be sure, and run the script again and see where it has installed node-red to. You won't need to uninstall nodejs, you are just fiddling with settings so no need to do that.