Tuesday, 17 September 2013

How to debug coffeescript on the server with node

How to debug coffeescript on the server with node

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?

No comments:

Post a Comment