Windows上的Ubuntu上的Bash中的BrowserSync(Linux子系统) - 无法打开浏览器

Ken*_*est 6 linux bash ubuntu npm browser-sync

我在Bash中使用浏览器同步,它不会自动打开浏览器并[BS] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false)在我输入npm startAngular示例时说.

当然,没有选择在有限的Linux环境中打开浏览器(因为在Windows上的Ubuntu上没有在Bash中提供GUI支持).

如果我使用Powershell,它的工作正常.

我的环境:Windows上的Ubuntu上的VS Code + Bash.

但是有配置或解决方法吗?

小智 3

因此,当我继续浏览时,我在这个网页https://gist.github.com/Kenty/9096000/revisions上找到了解决此问题的线索,这暗示我可以从错误消息中找到打开选项。我决定在我的电脑上搜索“bs.config.js”,当我搜索该文件时,我在 Angular 文件夹下的 \Template\node_modules\browser-sync\lib 文件夹中找到了一个名为 default.config.js 的文件,我终于找到了打开选项,并将打开选项从“local”(这是默认选项)更改为 false(注意,它没有引号),当我再次运行 npm start 命令时,在 git-bash 终端上工作正常,没有更多错误。