Hey! Just had a quick question about Chromeless and running it locally when localhost has a custom domain set. For web dev purposes, I have a custom domain in my hosts file for localhost. Ex:
127.0.0.1 mydomain.dev
It's highly possible I've completely missed/misinterpreted something in the guide on the main repo page, but is it possible to run chromless locally in a situation like this? If so, how could I go about doing that?
Definitely! By default chromeless does run locally unless you give it a remote location to "attach" to. Your custom-domains should still apply then as Chrome _should_ reference your hosts file. Is it not working as you'd expect?
Thank you for confirming that it should work even with custom domains. I might have something setup incorrectly on my end then. When I go to run my script, it opens Chrome as expected, but sits at the _about:blank_ page, and then I get this error in my terminal:
{ Error: getaddrinfo ENOTFOUND localhost undefined:9222
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'localhost',
host: undefined,
port: 9222 }
If I switch my hosts file back to using 127.0.0.1 localhost instead of 127.0.0.1 mydomain.dev, it works as expected.
This is making me think I'm misunderstanding something under the "Local Chrome Usage" section of the guide?
@kellylawrence Make sure that you leave localhost in your hosts config file, even when you add mydomain.dev:
127.0.0.1 localhost mydomain.dev
OR
127.0.0.1 localhost
127.0.0.1 mydomain.dev
Thanks @adieuadieu, that's all it was. I don't know how I didn't think of that, but thanks for pointing it out. Thanks again!
Most helpful comment
@kellylawrence Make sure that you leave
localhostin your hosts config file, even when you add mydomain.dev:127.0.0.1 localhost mydomain.devOR