The phantom process died when I use node -horseman to open phantomjs with nodejs

When I used 'node -horseman' to control phantoms using Node.js, I ran into a problem:

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) 

I just run this code:

 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(); 

I am sure my network is OK and I can connect this website in my browser, and I can also twist this URL and get a response. If I open charles or another vpn program, the problem will be fixed. I want to know why?

+5
source share

Source: https://habr.com/ru/post/1240757/


All Articles