Terence Chow
Terence Chow

Reputation: 11153

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:  

Upvotes: 36

Views: 22374

Answers (3)

Jeremy Wilken
Jeremy Wilken

Reputation: 6976

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"
}

Upvotes: 63

deb2fast
deb2fast

Reputation: 1000

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.

Upvotes: 38

Diego Netto
Diego Netto

Reputation: 41

This has been fixed in version 0.6.1

Update to the latest version by running npm install -g generator-ionic and then run yo ionic inside your current project and select Y when Yeoman asks if you would like to overwrite your Gruntfile.js

Upvotes: 4

Related Questions