Others in simlar situations have found that running the following commands to forcefully remove node and npm and then running the upgrade script, works for them. Note that if you use node.js for things other than node red then you might not want to do this as it removes all globally installed nodes. The node red install will put back the ones it needs but not others.
cd /usr/lib
sudo rm -rf node_modules
cd ~
sudo rm /usr/bin/node
sudo rm /usr/bin/npm
Note, be very careful, particularly with the rm -rf command. Some suggest using sudo rm -rf /usr/lib/node_modules
but I prefer to cd to /usr/lib then run the command on node_modules. The reason is that with the former command, if one accidentally put a space after the first / then it becomes a command that would completely remove everything from / downwards, so deleting your complete system.