I want to change where live-server opens, for example, I like using safari as my default browser, but every time I type live-server
in the terminal it will open a window on safari. I know I can type live-server --browser='google chrome'
but now I don't want to be typing that whole code to open in Chrome. I want to change it so that when I type live-sever
it will open on chrome instead, I know I have to change that in the .json file but I'm not sure where it's located, or how to access it in the terminal. Thank you in advance.
Asked
Active
Viewed 657 times
0

Ervin001
- 25
- 3
-
1Use a npm script for that? – Marc May 04 '22 at 18:08
-
Is there a way to modify the file where the information in npm live-server exist? – Ervin001 May 04 '22 at 23:03
-
Why do it the easy way when you can do it the hard way... live-server is open source. Go fork it and modify it like you want. – Marc May 05 '22 at 04:55
-
I do apologize, I looked into npm script and it appears that’s the way to go. – Ervin001 May 06 '22 at 01:40
2 Answers
1
I have found the solution after searching on the internet and it' straightforward. You just have to change your selected browser from you pc settings. It worked for me I hope it will work for you too!

es93
- 11
- 1
0
I found two methods that will solve this. The first is to go into the live-server code and change where it opens to google chrome
. The second which is much better IMO since you can do multiple options is as @Marc recommended, to use an npm script. A script will let you do multiple browsers. What I use now is the following script:
"glive": "live-server --browser=\"google chrome\" --open=\"dist/index.html\"",
The --open='dist/html'"
is only needed if your file is in a folder

Ervin001
- 25
- 3