How do I run livereload server on localhost after running Ionic serve command?

I recently started learning Ionic Framework. You can use Ionic serve command inside the project to run a livereload server. Once in a while it asked whether server should run on localhost or system ip. I chose second option. Now It doesn't ask anything and directly runs on system's ip.

How do reset this automatic behaviour?

I tried looking into serve.js file in ionic-cli project but no luck.

It's not necessary to edit the code. You can switch between addresses with the command ionic address. You'll then get options like this:

Please select which address to use by entering its number from the list below:
 1) 10.0.1.7 (en1)
 2) localhost

Found a workaround. I am using this method on ubuntu so paths may be different for other os.

Go to /usr/lib/node_modules/ionic/lib/ionic

Open serve.js with root user.

Find function called IonicTask.prototype.getAddress

Inside this function the value of variable isAddressCmd is false. Set it to true

self.isAddressCmd = false;

save the file. Now run Ionic serve for your project. This time it will ask for localhost vs ip again.

After this remove the newly added code from serve.js otherwise ionic serve won't work.