简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM