我有以下使用 Coffeescript、NodeJS PhantomJS 和 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;
)
在控制台中,当我使用coffee
命令运行时,它会出现[info] [phantom] Starting...
并挂在那里。
有没有办法调试它以找出发生了什么或者语法本身有问题?