You can see here I have done the first line and am doing the second one.
pi@TimePi:~ $ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
libdav1d3
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@TimePi:~ $ sudo npm -g update
npm ERR! code EEXIST
npm ERR! path /usr/bin/corepack
npm ERR! Refusing to delete /usr/bin/corepack: ../lib/node_modules/corepack/dist/corepack.js symlink target is not controlled by npm /usr/lib/node_modules/corepack
npm ERR! File exists: /usr/bin/corepack
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2024-09-29T01_01_42_577Z-debug.log
pi@TimePi:~ $
Is it I am doing things in the wrong order?
I have (as yet) NOT updated anything else.
pi@TimePi:~/.node-red $ npm update
ERROR: npm v10.8.3 is known not to run on Node.js v14.21.3. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.
ERROR:
/usr/lib/node_modules/npm/lib/utils/error-message.js:11
er.message &&= replaceInfo(er.message)
^^^
SyntaxError: Unexpected token '&&='
at wrapSafe (internal/modules/cjs/loader.js:1029:16)
at Module._compile (internal/modules/cjs/loader.js:1078:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
at Module.require (internal/modules/cjs/loader.js:1003:19)
at require (internal/modules/cjs/helpers.js:107:18)
at Object.<anonymous> (/usr/lib/node_modules/npm/lib/cli/exit-handler.js:2:48)
at Module._compile (internal/modules/cjs/loader.js:1114:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
pi@TimePi:~/.node-red $
Ah, I see, @TotallyInformation suggested that route. I think he was assuming that you did not use the usual install/upgrade script to install node red and nodejs. The update is failing because you have not updated nodejs first.
As I said in your original thread, just use the usual install/upgrade script to update node red and nodejs. Add --node20 on the end if you want to go to v20, which is probably a good idea. That will do everything you need.