That simple example you provided should word, you are totally right. I have little idea what could have gone wrong here, but here are some working hypotheses:
Working hypothesis 1: For whatever reason, the installation on the remote machine is broken. I have no idea what are the things that could break but here you need to go back to the “IT defaults”:
- Have you tried to turn it off and on again?
- Have you tried to deinstall it cleanly (making sure to delete all the files) and then re-install it?
Because of the SyntaxError, I favor this approach.
Working hypothesis 2: The damage happens somewhere on the network route. Maybe a reverse proxy (using regex?) is going wild and accidentially inserts strings into a file where they don’t belong? Here, you might need to dig deep, i.e. check firewalls, proxies etc. how they affect your traffic. A quick check might be maybe to create an SSH tunnel to circumvent those.
I hope while traveling down one of these paths, you will find some helpful information!