I used ionic serve
and got the below response to which I did not think twice and selected localhost
. However now I want to use option 1. Ionic has remembered my selection such that ionic serve
never allows me to select anymore and uses localhost
...
How can I change this so that ionic serve uses the first option?
Multiple addresses available. Please select which address to use by entering its number from the list below: 1) 192.168.2.10 (en0) 2) localhost Address Selection:
To serve to your LAN, specify the --external option, which will use all network interfaces and print the external address (es) on which your app is being served. Try the --lab option to see multiple platforms at once. ionic serve uses the Angular CLI. Use ng serve --help to list all Angular CLI options for serving your app.
By default, ionic serve boots up a development server on all network interfaces and prints the external address (es) on which your app is being served. It also broadcasts your app to the Ionic DevApp on your network. To disable the DevApp and bind to localhost, use --local. Try the --lab option to see multiple platforms at once.
Easily spin up a development server which launches in your browser. It watches for changes in your source files and automatically reloads with the updated build. By default, ionic serve boots up a development server on all network interfaces and prints the external address (es) on which your app is being served.
ionic serve [options] Easily spin up a development server which launches in your browser. It watches for changes in your source files and automatically reloads with the updated build. By default, ionic serve boots up a development server on localhost.
You can use the ionic address
command to update the selected address, which is available from Ionic 1.2.3.
Also, there is a file called ionic.config
which you can modify with this setting. On Mac/ubuntu this file is at ~/.ionic
. On a PC it can be found at c:/users/username/.ionic
. Inside you'll see something like this which you can edit the ionicServeAddress
value.
{ "ank": "...", "versionCheck": 1413143560174, "ionicServeAddress": "localhost" }
just type ionic address
command and you get the option to select your IP address again.
OR
you can explicitly select your address and port when you run ionic serve
by using the --address
and --port
options. Like this:
ionic serve --address IP_address --port port
example : ionic serve --address 192.168.1.129 --port 8101
Things to note
--address
the default port(8100) is used instead.ionic address
command instead.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With