Ionic serve don't launch browser

I created an ionic 2 application using CLI
ionic start myApp blank --v2

When I run ionic serve, I get the following output in console:
> ionic-hello-world@ ionic:serve /data/apps/myApp
> ionic-app-scripts serve “–v2” “–lab” “–address” “0.0.0.0” “–port” “8100” “–livereload-port” “35729”

[17:59:11]  ionic-app-scripts 1.1.0 
[17:59:11]  watch started ... 
[17:59:11]  build dev started ... 
[17:59:11]  clean started ... 
[17:59:11]  clean finished in 17 ms 
[17:59:11]  copy started ... 
[17:59:11]  transpile started ... 
[17:59:19]  transpile finished in 7.75 s 
[17:59:19]  preprocess started ... 
[17:59:19]  preprocess finished in less than 1 ms 
[17:59:19]  webpack started ... 
[17:59:20]  copy finished in 8.81 s 
[17:59:30]  webpack finished in 11.17 s 
[17:59:30]  sass started ... 
[17:59:33]  sass finished in 2.52 s 
[17:59:33]  postprocess started ... 
[17:59:33]  postprocess finished in less than 1 ms 
[17:59:33]  lint started ... 
[17:59:33]  build dev finished in 21.54 s 
[17:59:33]  watch ready in 21.63 s 
[17:59:33]  dev server running: http://localhost:8100/ 

[17:59:35]  lint finished in 2.48 s 

But the app is not launched automatically (I need to navigate to http://localhost:8100/ , there I can see it correctly).
The biggest problem for me, except of having to navigate to the url, is that --lab does not work for me (I guess from the same reason)

I tried to download an example application I found (https://forum.ionicframework.com/t/ionic-2-example-app/51756), and from there the app is launched correctly, even with --lab.

BTW, I have noticed that the example app has slightly a different structure than the one is generated for me.

1 Like

Lab works at my PC only in Firefox or Chrome as expected. IE got a weird layout.

Try ionic serve -w chrome --lab for example. This defines chrome as the browser to use. Maybe this helps

Nope… :frowning:

I work with Ubuntu 16.04, so anyway no IE worries.
The thing is that from the other app directory the app is launched with ionic serve and ionic serve --lab.

Hi guys, I’ve gotten the same issue here.

I work with Ubuntu 16.04 too (64-bit version) and I installed the lastest versions of Ionic (framework and CLI) and Cordova.

The biggest problem for me was the livereload which was not fully functional: as ionic serve didn’t launch browser, it didn’t refresh the browser after rebuild… I had to manually refresh it :disappointed:

I solved it using the -w option (ionic serve -w “google-chrome”).

Even with a default browser specified in system properties, I had to specified the browser through the ionic command. And that’s works :slight_smile:

My ionic info:

cedric@ubuntu:~/Projects/projectTest$ ionic info
******************************************************
Your system information:

Cordova CLI:  You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.5.0

Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.9.5
Xcode version: Not installed

I’m having exactly the same problem but with this terminal output:

root@352d83ce533b:/projects/myApp# ionic serve
Starting app-scripts server: --port 8100 --livereload-port 35729 --address 0.0.0.0 - Ctrl+C to cancel
[15:06:27]  watch started ...
[15:06:27]  build dev started ...
[15:06:27]  clean started ...
[15:06:27]  clean finished in 17 ms
[15:06:27]  copy started ...
[15:06:27]  transpile started ...
[15:06:31]  transpile finished in 3.53 s
[15:06:31]  preprocess started ...
[15:06:31]  deeplinks started ...
[15:06:31]  deeplinks finished in 19 ms
[15:06:31]  preprocess finished in 23 ms
[15:06:31]  webpack started ...
[15:06:31]  copy finished in 3.97 s
[15:06:41]  webpack finished in 10.07 s
[15:06:41]  sass started ...
[15:06:43]  sass finished in 1.55 s
[15:06:43]  postprocess started ...
[15:06:43]  postprocess finished in 15 ms
[15:06:43]  lint started ...
[15:06:43]  build dev finished in 15.27 s
[15:06:43]  watch ready in 15.51 s
[15:06:43]  dev server running: http://localhost:8100/

[15:06:43]  Failed to open the browser: Command failed: xdg-open "http://localhost:8100" /usr/bin/xdg-open: 771:
            /usr/bin/xdg-open: www-browser: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open: links2: not found
            /usr/bin/xdg-open: 771: /usr/bin/xdg-open: elinks: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open:
            links: not found /usr/bin/xdg-open: 771: /usr/bin/xdg-open: lynx: not found /usr/bin/xdg-open: 771:
            /usr/bin/xdg-open: w3m: not found xdg-open: no method available for opening 'http://localhost:8100'
[15:06:46]  lint finished in 3.52 s

Thanks, it works!!

Anyway, till now I didn’t have a problem of refreshing, actually each time I save some change in my code ionic compiles and the view is automatically refreshed.

And in order to access lab mode I used this url:
http://localhost:8100/ionic-lab
(just in case someone will find it useful…)

I am new to Ionic - getting the same error

I have tried all the above help but still - app is not latching in browser

Any help?
Thanks in advance

If your also a Windows user, try using ionic serve by a Git for Windows command (same as windows command line, but fully integrated with node.js).

[https://gitforwindows.org/]

@FrancoisIonic Sorry for a very late reply - I did manage to find a work around by using the below

ionic cordova run browser

The above worked for me -

Thanks

Nice, that makes 2 alternative solutions if other people have the same issue.