BrowserSync in Bash on Ubuntu on Windows (Linux subsystem) - Could not open browser

I use browser synchronization in Bash, it doesn’t open the browser window 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 print npm start in Angular.

Of course, there is no way to open a browser in a limited Linux environment (since GUI support is not provided in Bash on Ubuntu on Windows).

If I use Powershell, it works fine.

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

But is there a config or workaround?

+5
source share
1 answer

So, while I continued browsing, I found the key to solving this problem on this web page https://gist.github.com/Kenty/9096000/revisions , which tells me where I can find the open option from the error message. I decided to find "bs.config.js" on my computer and I found a file called default.config.js in the \ Template \ node_modules \ browser-sync \ lib folder in my angular folder and when I looked at the file, I finally , found the open option and changed the open option from "local" (which is the default option) to false (note that without the quotes), and when I ran the npm start command again, the terminal worked on git - bash and there were no more errors It was.

+3
source

Source: https://habr.com/ru/post/1268041/


All Articles