我试图从NightmareJS文档中运行示例代码:
var Nightmare = require('nightmare'),
nightmare = Nightmare();
nightmare.goto('http://cnn.com')
.evaluate(function(){
return document.title;
})
.end()
.then(function(title){
console.log(title);
})
$ node test.js
但节点返回错误:
/home/user1/node_modules/nightmare/lib/nightmare.js:84
this.queue((done) => {
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/user1/test.js:1:79)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
什么会导致此类错误?可能是旧版本的节点? 节点版本为v0.10.25。