Javascript 当我使用node horseman打开带有nodejs的phantomjs时,幻影进程终止了
当我通过node.js使用“node horseman”控制phantomjs时,我遇到了一个问题:Javascript 当我使用node horseman打开带有nodejs的phantomjs时,幻影进程终止了,javascript,node.js,phantomjs,charles-proxy,Javascript,Node.js,Phantomjs,Charles Proxy,当我通过node.js使用“node horseman”控制phantomjs时,我遇到了一个问题: Unhandled rejection HeadlessError: Phantom Process died at ClientRequest. (/Users/zhuyingda/nodejs/veneno/node_modules/node-phantom-simple/node-phantom-simple.js:655:12) at emitOne (events.js:77:13)
Unhandled rejection HeadlessError: Phantom Process died
at ClientRequest. (/Users/zhuyingda/nodejs/veneno/node_modules/node-phantom-simple/node-phantom-simple.js:655:12)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketOnEnd (_http_client.js:288:9)
at emitNone (events.js:72:20)
at Socket.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at doNTCallback2 (node.js:441:9)
at process._tickCallback (node.js:355:17)
我只是运行以下代码:
var Horseman = require('node-horseman');
var horseman = new Horseman();
horseman
.userAgent("Mozilla/5.2 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0")
.on('resourceRequested', function (requestData, networkRequest) {
if(!/[png|jpg|js|css]$/.test(requestData.url)){
console.log(requestData.url);
}
})
.open('http://www.zhuyingda.com')
.log() // prints out the number of results
.close();
我确信我的网络是好的,我可以在我的浏览器中连接这个网站,我也可以卷曲这个url并得到一些响应。
如果我打开charles或其他vpn程序,问题就会得到解决。我想知道为什么?如果是bug,试试看,效果很好。