weld-io / scraping-service

REST API for scraping dynamic websites using Node.js, headless Chrome and Cheerio.
MIT License
64 stars 14 forks source link

Cannot connect to browser ECONNREFUSED #1

Open amite opened 6 years ago

amite commented 6 years ago

When I try the base case example provided in the README with hacker news, here is the error I get back in my console:

Cannot connect to browser: { Error: connect ECONNREFUSED 127.0.0.1:9222
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1136:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 9222 }
GET /api/scrape?url=https://news.ycombinator.com&selector=.title+a 400 41.008 ms - 110
hishamhaniffa commented 6 years ago

same issue

UPDATE:

I was able to get this script work by installing Google Chrome Canary and running it as a headless browser.

tomsoderlund commented 6 years ago

@amite @hishamhaniffa I'm running regular Google Chrome 61.0.3163.100 on a Mac.

Did you use the --headless option as specified in README?