Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set ionic serve to not open a browser by default?

I have multiple browser windows usually and it's always not popping up on the one I want.

Can I disable the feature of ionic serve opening in a browser?

like image 894
Stephen Leung Avatar asked Dec 11 '15 00:12

Stephen Leung


People also ask

How do you stop an ionic serve?

ionic serve run the app and then ctrl + c to cancel.

Can only be run in an ionic project directory?

ionic serve can only be run in an Ionic project directory, make sure you create an empty "www" directory at the project root. If cordova does not find a "www" directory, it will cry out that error.


3 Answers

You can pass in the --nobrowser option, or simply -b:

ionic serve --nobrowser
like image 68
Claudiu Avatar answered Oct 23 '22 17:10

Claudiu


Old CLI: As @Claudiu mentioned ionic server -b will not start a browser.

New CLI: the new command is ionic serve --no-open.

If you want to start a browser but not the default one, you can use the -w option.

Eg if Chrome is your default browser, but you want ionic serve to use Firefox instead, you can do something like

ionic serve -w "path/to/firefox.exe" or just ionic serve -w firefox if Firefox is in the path.

More info on ionic serve options:

  • http://ionicframework.com/docs/v2/cli/serve/
  • ionic serve --help
like image 30
user276648 Avatar answered Oct 23 '22 16:10

user276648


ionic serve --no-open is the new command. The no-browser has been deprecated

like image 6
Colonel Mustard Avatar answered Oct 23 '22 17:10

Colonel Mustard