Tom Schreck
Tom Schreck

Reputation: 5287

ionic serve always uses localhost

I'm trying to get ionic 2 to work on my Mac. ionic serve always uses localhost even though I've selected an IP Address (192.168.1.234) using ionic address. Here are my particulars:

enter image description here

enter image description here

enter image description here

You can see that I issue command ionic serve --address 192.168.1.234 yet ionic serve alwys uses http://localhost:8100. I'm relatively new to working with Macs, so I'm thinking there's a Mac setting someplace I need to make. I've verified through System Preferences -> Network that my Mac is using 192.168.1.234 as its WiFi IP Address. This is preventing me from being able to test my ionic app on my iPhone device.

Any idea what I'm missing? Thanks for your help.

Upvotes: 1

Views: 1773

Answers (2)

Tom Schreck
Tom Schreck

Reputation: 5287

I found a work-around that allows me to accomplish my goal of serving my ionic app over my WiFi IP Address so I can test development on physical devices. I installed Web Server for Chrome plugin which will act as a web server on my mac. I can choose the folder and port number. This will allow me to access my app from my phone. I'm not able to get ionic serve to utilize my WiFi Ip Address (192.168.1.234). I am new to Macs, so I'm assuming it's a web server issues. My work around is a bit clumsy, but I can accomplish my goal.

Hope this helps. If anyone has insight, please reply. Thanks.

Upvotes: 0

Rai Vu
Rai Vu

Reputation: 1635

Please try this :

ionic serve --address YOUR_IP_ADDRESS

Please note that YOUR_IP_ADDRESS should be an available IP which is assigned to your actual device. For example if your (static or dynamic) IP address is 192.168.0.110, you cannot do "ionic serve" with 192.168.0.111 or 192.168.0.112 etc.

Upvotes: 2

Related Questions