I am also facing a similar Nodejs issue on ubuntu. Here is the error.
Running Node-RED install for user dem at /home/dem on ubuntu
Nodejs 10 is no longer supported.
You can update to the latest Node-RED 1.x version by adding --nodered-version="1.3.5"
to that install command. If in doubt this is the safer option.
Or you can force an install of node 12 or 14 by using the --node12, --node14 or --node16 parameter
However doing so may break some nodes that may need re-installing manually.
Generally it is recommended to upgrade all nodes to their latest versions before upgrading.
Please backup your installation and flows before upgrading.
Note: not all embedded hardware can be updated via this method - please check before proceeding.
Exiting now.
When I try to update to the latest version of node-red by running command --nodered-version="1.3.5" I get this error.
The message
"You can update to the latest Node-RED 1.x version by adding --nodered-version="1.3.5"
to that install command." is misleading because the latest version of node-red is 2.1.4.
To install that, use the script and as Steve suggests add --node14 after the closing bracket. Don't specify a node-red version.
Edit darn but this is hard to get right on a phone!
I suspect the command run was --nodered-version="1.3.5" which has come up before, even though that is not what the instructions say. I think the text could be improved, it does not make it clear that 1.x is not the latest version of node red. Perhaps the words could be improved by saying something like
Nodejs 10 is not supported by node-RED V2.x
Then put the bit about installing 12 or 14, then
If you do not wish to update nodejs you can update to the last version of Node-RED 1.x by adding --nodered-version="1.3.5" to the bash command.
however using bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node16 worked perfectly except "node-red core" was not installed.
E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1340 (packagekitd)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/lib/apt/lists/
Is the problem still there if you try again? It could be caused by you trying to do it at the same time as something else was trying to use apt in the background.
If it still happens then reboot and wait a while then try again.
If it still happens then run ps -aux | grep nnnn
where nnnn is the process id referenced in the error.