I can confirm that the command works on my Unipi Patron. Node-red upgrade from 2.2.2 to 3.0.2 worked well.
I had to use the "--node14" parameter to upgrade nodejs, because Node-red 3 doesn't support nodejs 12.
After running the script I had to reboot the Unipi with:
sudo /sbin/shutdown -r now
Official documentation (applicable to any Debian-based distribution):
https://nodered.org/docs/getting-started/raspberrypi