johntitus / node-horseman

Run PhantomJS from Node
MIT License
1.45k stars 124 forks source link

Request() error evaluating getProperty() #221

Open elaich opened 8 years ago

elaich commented 8 years ago

I just wanted to try node-horseman, with a basic example but I have this error, I have no idea why it isn't working.

const Horseman = require('node-horseman');

const horseman = new Horseman();
horseman
    .open('https://www.google.com')
    .html('body')
    .then((body) => {
        console.log(body);
    })
    .catch((err) => {
        console.log(err);
    })
    .close();
 > node test.js 
{ HeadlessError: Request() error evaluating getProperty() call: Error: connect ECONNREFUSED ::1:37147
    at ClientRequest.<anonymous> (/home/sicksince/projects/soccerscaper/node_modules/node-phantom-simple/node-phantom-simple.js:506:18)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:308:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1271:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  name: 'HeadlessError',
  message: 'Request() error evaluating getProperty() call: Error: connect ECONNREFUSED ::1:37147' }
awlayton commented 8 years ago

It sounds like an HTTPS problem. Try passing {ignoreSSLErrors: true} to the constructor.

elaich commented 8 years ago

Sorry, I tried a lot of urls, and I have the same error, using http or https protocol, weird!!

elaich commented 8 years ago

It gets more interesting, I can have this error by only creating a new horseman instance, like:

var Horseman = require('node-horseman');
var horseman = new Horseman();

And got the same error, what could cause this ?

> node test.js 
Unhandled rejection HeadlessError: Request() error evaluating getProperty() call: Error: connect ECONNREFUSED ::1:46295
    at ClientRequest.<anonymous> (/home/sicksince/projects/soccerscaper/node_modules/node-phantom-simple/node-phantom-simple.js:506:18)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:308:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1271:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
wong2 commented 7 years ago

@elaich which phantom version are you using? seems this error will occur if the phantom process crashed

antonymca commented 7 years ago

i am facing the above issue in my mac, it was running fine few months back. But now i am getting this error.

name: 'HeadlessError', message: 'Request() error evaluating getProperty() call: Error: connect ECONNREFUSED ::1:64158' } { HeadlessError: Request() error evaluating getProperty() call: Error: connect ECONNREFUSED ::1:64157

Phantom Version : 2.1.1 Node : 6.9.5 ENV : Mac sierra version 10.12.13

Any help.