Where are you running the script from? If you are using ESKT make sure Photoshop is the target app or add #target photoshop at the top of the script.
As far as I know only Photoshop has an ActionReference class. If another app is running the script you will get that error. The default target app for ESTK is ESTK itself.