Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BrowserSync in Bash on Ubuntu on Windows (Linux Subsystem) - couldn't open browser

I use browser-sync in Bash, it doesn't auto-open browser and says [BS] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false) when I type npm start in Angular example.

Of course there's no option to open a browser in limited Linux environment (since no GUI support provided in Bash on Ubuntu on Windows).

If I use Powershell, it's working OK.

My environment: VS Code + Bash on Ubuntu on Windows.

But is there a config or workaround?

like image 272
Kenya-West Avatar asked May 20 '17 04:05

Kenya-West


1 Answers

So while I kept browsing, i found a clue to the solution of this problem on this webpage https://gist.github.com/Kenty/9096000/revisions which hinted me of where i could find the open option from the error message. I decided to searched for "bs.config.js" on my pc and i found a file called default.config.js in my \Template\node_modules\browser-sync\lib folder under my angular folder and when i searched through the file, i finally found the open option and changed the open option from "local" (which is the default option) to false (Note, it's without the quotes) and when i ran the npm start command again, on the git-bash terminal It worked and there were no more errors.

like image 115
Kazım Ödemiş Avatar answered Sep 26 '22 17:09

Kazım Ödemiş