Ionic serve -w chrome or --browser chrome not working

Also defaultBrowser in ionic.browser.config doesn’t work per discussions I’ve seen in git and stack overflow. My app is an Ionic 2 one.
Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: OS X Yosemite
Node Version: v7.7.3
Xcode version: Xcode 7.2.1 Build version 7C1002
If I leave no browser it only ever launches Safari.
If I change it to Chrome, no browser ever opens.
When code runs it echoes this:

ionic-app-scripts serve “–v2” “–browser” “chrome” “–address” “0.0.0.0” “–port” “8101” “–livereload-port” “35730”

[01:18:46] ionic-app-scripts 1.1.4
[01:18:46] watch started …
[01:18:46] build dev started …
[01:18:46] clean started …
[01:18:46] clean finished in 2 ms
[01:18:46] copy started …
[01:18:46] transpile started …
[01:18:48] transpile finished in 1.69 s
[01:18:48] preprocess started …
[01:18:48] preprocess finished in less than 1 ms
[01:18:48] webpack started …
[01:18:48] copy finished in 1.78 s
[01:18:53] webpack finished in 5.03 s
[01:18:53] sass started …
[01:18:54] sass finished in 755 ms
[01:18:54] postprocess started …
[01:18:54] postprocess finished in less than 1 ms
[01:18:54] lint started …
[01:18:54] build dev finished in 7.49 s
[01:18:54] watch ready in 7.51 s
[01:18:54] dev server running: http://localhost:8101/

[01:18:55] lint finished in 879 ms

I was also getting messages about Cordova not being present.
Googling led me here:

ionic run browser, fixed that and now Chrome launches… I think chrome is default for that command. So I guess that’s a workaround for now.

I ended up making Chrome my default browser at the OS level and that fixed it

ionic serve at one point used to open a browser on run but for me it hasn’t for some time now. I though just navigate to the http://localhost:8101 in Chrome (or whatever browser you want to use). If you keep the command alive then it will do a live reload and you don’t ever need to refresh or touch the browser.

A bit of a pain when you first run ionic serve but you only need to do that once per development sitting.

For a newbie to ionic it’s a painful experience. So many things don’t work the way documentation states. I just wish someone maintained the documentation per version. Maybe Ionic should generate documentation per minor release based on results of unit tests would be the way forward. Extras/Images for example in Android Studio. Links in documentation that go to non existent pages. When I say this I think it should apply to all technologies in the architecture hierarchy. So Cordova, npm etc as well

I agree that there are spots of the ionic docs that are lagging. The development has been moving very quickly and those have gotten left behind sometimes but I commend the team on all their hard work.

If you want the most up-to-date information for sub projects such as the cli check out the Readme and Changelog on their Github page.

Also for the cli take a look at ionic --help for more info.

Lastly if you find something missing or in need of updating you can help by submitting pull requests on GitHub with the updated documentation.

1 Like