Bugger. I've just noticed what I've done, but I still can't pinpoint exactly.
I ran a script earlier which I wrote some time ago which changes some of the internal vesta files, where I did some careless regex find and replacing.
I reckon that must be the culprit.
How can I restore /usr/local/vesta without losing vital data (like users, crons, etc), besides reinstalling completely?
I think it's just the template directories that need fixing. I really don't want to reinstall vesta. That brought so many problems last time I did.
OK, I think I know what's happened.
The script I wrote restores a previous version before running, and it appears to have restored a version from late 2015, untouched by any recent updates, and so when app.js asks for the GLOBAL variable, it won't find it because it didn't exist in the 2015 version of VestaCP.