The error when installing Node.js v12 is a known issue in Debian 8 (Jessie).
But it works correctly in Stretch or Buster.
As Jessie is not really supported anymore, it would be better to upgrade the OS. If that is no option for you, then Node.js v10 should indeed work fine.
Try setting the default application for root to the same value as for pi:
filetype=$(xdg-mime query filetype file:///home/pi/index.html)
defaultapp=$(xdg-mime query default $filetype) # query as pi
sudo xdg-mime default $defaultapp $filetype # set as root
Alternatively, executing sudo -u pi xdg-open file:///home/pi/index.html should use the settings of ...