chrome-launcher icon indicating copy to clipboard operation
chrome-launcher copied to clipboard

if userDataDir === false, connection to chrome fails (chrome is launched)

Open yuvke opened this issue 7 years ago • 6 comments
trafficstars

Hey, I'm experiencing this consistently on Mac machines. Calling launch with the following options:

chromeLauncher.launch({
        startingUrl: 'http://google.com',
        userDataDir: false,
})

throws the following error:

{ Error: connect ECONNREFUSED 127.0.0.1:50128
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 50128 }

Any way to circumvent this (and still use the default profile)?

yuvke avatar Aug 09 '18 13:08 yuvke

userdatadir has to take a string. either you provide a new location, or chrome-launcher will create a tmpdir.

paulirish avatar Sep 10 '18 00:09 paulirish

@paulirish - so this section from the docs is outdated?

// (optional) Chrome profile path to use, if set to false then the default profile will be used. // By default, a fresh Chrome profile will be created userDataDir: string | boolean;

yuvke avatar Sep 10 '18 09:09 yuvke

whoops, no, that is still correct.

I'm not having an issue with running with userDataDir: false, though. Can you give more info on your machine and a smallish snippet of init code that reproduces the error for you?

brendankenny avatar Sep 10 '18 18:09 brendankenny

@yuvke oops. sorry! i was wrong about that.

paulirish avatar Sep 10 '18 19:09 paulirish

@brendankenny Sure thing.

First, let me note that chrome opens the url as expected. The issue is that after a while the error is thrown. I've tested it with the following snippet:

const chromeLauncher = require('chrome-launcher');

return chromeLauncher.launch({
    startingUrl: 'http://google.com',
    userDataDir: false,
}).catch((err) => {
    console.log('caught');
    console.log(err);
});

which prints out:

caught
{ Error: connect ECONNREFUSED 127.0.0.1:63618
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 63618 }

I'm running this on: OSX 10.12.6 iTerm2 3.20 node 8.11.4 chrome-launcher 0.10.2

yuvke avatar Sep 11 '18 15:09 yuvke

I'm having the same problem, but in windows 10

OS: Windows 10 Pro v.1803 node: 8.11.4 chrome-launcher: 0.10.2.

Here is the log when I launch the launcher:

image

sarvaje avatar Sep 11 '18 19:09 sarvaje