Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic serve displays multiple addresses and I chose wrong one...How to change address that ionic serve uses?

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:   
like image 575
Terence Chow Avatar asked Oct 12 '14 17:10

Terence Chow


People also ask

How to use ionic serve to serve an app?

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.

How to bind ionic serve to localhost?

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.

How does ionic serve work in Eclipse?

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.

What does ionic serve do in Ubuntu?

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.


2 Answers

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" } 
like image 89
Jeremy Wilken Avatar answered Oct 11 '22 19:10

Jeremy Wilken


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

  • If you do not provide a port option with --address the default port(8100) is used instead.
  • Specifying address and port will only change the settings for that session. if you need to override saved settings, you should probably use the ionic address command instead.
like image 35
deb2fast Avatar answered Oct 11 '22 20:10

deb2fast