Use the phantom npm module which is maintained and works with the latest version of phantomjs.