How do I set ionic serve to use Chrome as the defa

2020-07-02 11:41发布

问题:

I want to run ionic serve with Google Chrome.

I've tried:

ionic serve --browser chrome
ionic serve --browser google-chrome

But that doesn't work. I can get it to use firefox if I type:

ionic serve --browser firefox

How do I set the default browser for ionic serve to Chrome?

回答1:

In ionic.project file add:

"defaultBrowser": ""

OR

"defaultBrowser": "chrome"

and try ionic serve

this is working..!

u can also try :

"defaultBrowser": "firefox"

this.. and this.. might be help..



回答2:

On Mac, option -f chrome is not working, on ionic version 2.1.8

Use ionic serve --browser "google chrome"

It will set the default browser to Chrome.



回答3:

Try ionic serve -w chrome, this will serve ionic2 in Chrome (ionic2 RC4+)



回答4:

Try ionic serve -f chrome. This will set default ionic browser to Chrome and subsequent ionic serve commands will run in Chrome.



回答5:

As of working in Ionic v3.9.2, you can open this using

$ionic lab --browser chrome 

command to open the app in Google Chrome by default.



回答6:

cordova run browser -- --port=8001 --target=Firefox

OR

cordova run browser --target=Firefox

OR

cordova run browser  --target=Chrome

OR

cordova run browser -- --port=8001 --target=Chrome

Thanks



回答7:

For Ionic 3 and mac you need to type like this: ionic serve -w "Google Chrome"



回答8:

The following will work in Windows when anyone face issue in ionic serve -f chrome:

ionic serve --browser "chrome"



回答9:

And this works on my Mac:

ionic serve --browser "google chrome"



回答10:

ionic serve -w chrome this works for me and successfully launch my app on chrome



回答11:

you can try with these commands when you fire up your app

ionic serve --browser "google chrome"

ionic serve --browser "safari"

ionic serve --browser "firefox"