tools: polymer serve --hostname doesn't work as described
Description
When I tried to serve my project locally with a specified hostname, it doesn’t work and gives me an error:
> polymer serve --hostname 'test'
Starting Polyserve...
serving on port: 8080
from root: L:\Dennis\Web_Development\solari
Files in this directory are available under the following URLs
applications: http://'test':8080
reusable components: http://'test':8080/components/solari/
error: Promise rejection: Error: getaddrinfo ENOTFOUND 'test'
error: Error: getaddrinfo ENOTFOUND 'test'
at errnoException (dns.js:26:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
This has to be a bug because I just copied the example described in the docs.
Versions & Environment
- Polymer CLI: 0.12.0
- node: 4.2.1
- Operating System: Windows 10
Steps to Reproduce
- Create an application project:
polymer init application - Serve:
polymer serve --hostname 'test'
Expected Results
No error is throw and I can access my application under http://test:8080
Actual Results
Opening http://test:8080 results into a DNS-Address of server test not found.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (7 by maintainers)
Commits related to this issue
- Update polymer-cli docs to mention /etc/hosts file Regarding https://github.com/Polymer/polymer-cli/issues/312 — committed to JimPanic/docs by JimPanic 8 years ago
how can I change the localhost path to https://localhost:8080
@IchordeDionysos Ah of course, I forgot that local hostnames were configurable. Thanks for the clear explanation.
Try removing the quotes around
test, does it work now? I get the expected results once addingtestto my/etc/hostsfiles and running the following:I created a pull request here: https://github.com/Polymer/docs/pull/1703
@IchordeDionysos You’ll have to first let your computer know about that hostname. This can be done by adding an entry to your hosts file (Linux/Unix/OS X:
/etc/hosts, Windows:C:\Windows\System32\Drivers\etc\hosts):This way the name you’re trying to listen to also resolves to an IP which is essential.
@FredKSchott
testis a valid hostname to Node so long it resolves to an IP.localhostis no different. You will find that if you remove the line defininglocalhostfrom your/etc/hostsfile (which usually comes pre-filled with any modern OS), it will no longer resolve either – just liketestdoes.