I use Cloud9 which is a hosted IDE site. They do some host/port mapping stuff so they want me to use an environment variable whenever I start a server. I understand that I can pass the $PORT variable to the -p argument, but there doesn't appear to be an argument for the host, or ip address which I could pass the $IP variable to. 
npx parcel-bundler index.html -p $PORT -h $IP
@jessehattabaugh - Please see #278 for further discussion. The default host aligns with the host that Cloud9 specifies in their docs, so parcel should "just work" in Cloud9 without specifying a host. If this is not the case, please reply and we'll work through a solution.
@brandon93s I'm having a similar issue, perhaps I'm missing something here. I work on a remote server (i.e. not localhost) and starting and accessing the parcel HMR by the remote IP/domain works, the trouble is the socket connection is looking for http://localhost:<ws-port> which means the only way I've been able to get it working is to point localhost in my hosts file to my remote.
I see. I had approached this from the perspective of the HTTP server and not the implications on the HMR socket. Will re-open for further investigation.
I'm having the same issue here.
I'm using a smartphone to connect to the website over LAN and the HMR fails to establish the connection
because the WebSocket is connecting to the localhost instead of window.location.hostname.
I fixed this issue by forking parcel and changing this:
https://github.com/parcel-bundler/parcel/blob/0eb4487491fd70390697ad413aeac994fca4309c/src/builtins/hmr-runtime.js#L18
to:
var ws = new WebSocket('ws://' + window.location.hostname + ':{{HMR_PORT}}/');
This seemed like a pretty quick fix for an issue that can cause a lot of headaches, opened #426 above thanks to @leonardosnt's comment.
Unfortunately, I still have an issue in Cloud9 at Amazon Web Services.
parcel src/client/index.html -p 8080Now, it's not possible to open the server by the URL given by Parcel console log - but with the one given by Cloud9 for view in a separate window.
But the following error appears:

I don't think this actually made it out in a release yet, unless you're specifically using master. Additionally, you'll need to specify both the port -p and hmr-port -h
Last release was 4 days ago, the code commits about 5 days ... mhm, maybe I am wrong, but I thought the code is already published.
It's not in the latest (1.4.1), so you'll need to pull from master
Mhm, wenn I install from parcel-bundler/parcel (master), I get the following error:
> node_modules/.bin/parcel src/index.html
module.js:471
    throw err;
    ^
Error: Cannot find module '../lib/cli'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/ubuntu/workspace/test-parcel/node_modules/parcel-bundler/bin/cli.js:6:7)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
Closing. Should be fixed by #426.
Hello,
I am not able to make parcel work in cloud 9 out of the box. I am running:
parcel ./src/index.html --https --port $PORT --hmr-hostname $IP --no-hmr -d ./parcel
The error message from cloud 9:
You may be using the wrong PORT & IP for your server application.Try passing $PORT and $IP to properly launch your application.
I was looking for some sort of '--host' parameter which I could pass $IP. This is for the basic site, not hmr (I thought I read above that you needed --hmr-hostname to make it work). Using v1.6.2.
Most helpful comment
I'm having the same issue here.
I'm using a smartphone to connect to the website over LAN and the HMR fails to establish the connection
because the WebSocket is connecting to the localhost instead of
window.location.hostname.I fixed this issue by forking parcel and changing this:
https://github.com/parcel-bundler/parcel/blob/0eb4487491fd70390697ad413aeac994fca4309c/src/builtins/hmr-runtime.js#L18
to: