我在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)
当我在Angular示例中键入npm start
。
当然,没有select在有限的Linux环境下打开浏览器(因为在Windows上的Ubuntu上的Bash没有提供GUI支持)。
如果我使用Powershell,它工作正常。
我的环境:Windows上的Ubuntu VS + Bash。
但有没有configuration或解决方法?
所以,当我继续浏览时,我发现这个问题的解决方案在这个网页https://gist.github.com/Kenty/9096000/revisions暗示我在哪里可以找到从错误信息的打开选项的线索。 我决定在我的电脑上搜索“bs.config.js”,并在我的angular文件夹下的\ Template \ node_modules \ browser-sync \ lib文件夹中找到一个名为default.config.js的文件,当我通过文件搜索,我终于找到了开放选项,并将开放选项从“本地”(这是默认选项)更改为false(注意,它没有引号),当我再次运行npm start命令时,在git-bash终端上工作,没有更多的错误。