2015-12-24 66 views
3

我複製粘貼在Github的例子:NightmareJS不會返回任何東西到終端?

app.js:

var Nightmare = require('nightmare'); 
var vo = require('vo'); 

vo(function*() { 
    var nightmare = Nightmare({ show: true }); 
    var link = yield nightmare 
    .goto('http://yahoo.com') 
    .type('input[title="Search"]', 'github nightmare') 
    .click('.searchsubmit') 
    .wait('.ac-21th') 
    .evaluate(function() { 
     return document.getElementsByClassName('ac-21th')[0].href; 
    }); 
    yield nightmare.end(); 
    return link; 
})(function (err, result) { 
    if (err) return console.log(err); 
    console.log(result); 
}); 

我所做的:npm install nightmare vo

然後node --harmony app.js但沒有任何輸出:

[email protected]:~/node/nightmarejs$ node --harmony app.js 
[email protected]:~/node/nightmarejs$ 

沒有錯誤無論如何。可能是什麼問題?

(我的Ubuntu上運行節點V5.2.0)

+0

你無頭無蹤地跑噩夢? – Ross

回答