google to the rescue … must remember to google the actual error message and not what you think the problem is.
I googled “rpi magic mirror cannot open display” and it displayed some posts about this very issue … one of them contained this suggestion …
Ok, there might be a problem with your electron installation.
Can you go into your MagicMirror folder and type “node serveronly”?
Then, go back to your browser window and type in “localhost:8080”
Jump over to the mm folder, mistype ‘note serveronly’ and then ‘node serveronly’ … and my mm is back :)
how to I make node serveronly permanent? Embed it in the mm.sh start script?
Edit: answer: that worked on reboot.
mm.sh now contains …
cd ./MagicMirror
DISPLAY=:0 npm start
node serveronly