I've got below code that is run with Coffeescript, NodeJS PhantomJS and SpookyJS
try
Spooky = require 'spooky'
mysql = require 'mysql'
catch e
console.log e
Spooky = require 'node_modules/spooky/lib/spooky'
spooky = new Spooky(
casper: ->
logLevel: 'debug',
verbose: true
(err) ->
if (err)
e = new Error('Failed to initialize SpookyJS')
e.details = err
throw e
spooky.on 'error', (e) ->
console.error e
spooky.on 'log', (log) ->
if (log.space == 'remote')
console.log log.message
spooky.on 'console', (line) ->
console.log line
spooky.start 'http://www.website.com/'
spooky.thenEvaluate ->
console.log 'Hello, from', document.title;
spooky.run;
)
In the console when I run with coffee
command, it comes up with [info] [phantom] Starting...
and hangs there.
Is there a way to debug this to find out what is going on or are there something wrong with the syntax itself?
You can run coffee --compile file.coffee
to attempt to compile a CoffeeScript file into JavaScript. If it compiles properly, then there are no CoffeeScript syntax errors, and you have the compiled JavaScript version that you can use to debug.