BrowserSync Gulp doesn#39;t open in Chrome(BrowserSync Gulp 无法在 Chrome 中打开)
问题描述
我尝试在 Chrome 中使用 BrowserSync 和 Gulp 在本地主机上打开我的网站,但它不起作用.默认情况下,它在 Firefox 中打开,一切正常.但是,当我更改 gulpfile.js 中的参数以在 Chrome 中打开网站时 - 我有以下信息:
I try to open my website on localhost using BrowserSync and Gulp in Chrome, but it doesn't work. Default, it open in Firefox and everything works well. But, when I change params in gulpfile.js to open website in Chrome - I have this information:
[Browsersync] 无法打开浏览器(如果您在无头环境,您可能希望将 open 选项设置为 false)我在 gulpfile.js 中的配置:
[Browsersync] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false) My config in gulpfile.js:
// browser-sync options
// see: https://www.browsersync.io/docs/options/
var browserSyncOptions = {
browser: "google chrome",
proxy: "localhost",
notify: false
};
我尝试了chrome"、chrome-browser",但没有任何反应.我应该怎么做?注意:我有 Ubuntu 17.04,Chrome 是我的默认浏览器.
I tried "chrome", "chrome-browser", nothing happend. What I should to do? Notice: I have Ubuntu 17.04, Chrome is my default browser.
推荐答案
我认为问题出在您的端口上,尝试将您的代理更改为以下:
I think the issue is with your port, try to change your proxy to below :
var browserSyncOptions = {
browser: "google chrome",
proxy: "localhost:3001",
notify: false
};
并使用此端口在 chrome 中检查您的网站:
and check your website in chrome with this port :
http://localhost:3001
更新:
也尝试在 browserSync 中使用相同的端口:
Also try to use the same port in browserSync :
browserSync({
proxy: 'localhost:3001'
});
这篇关于BrowserSync Gulp 无法在 Chrome 中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:BrowserSync Gulp 无法在 Chrome 中打开


- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Fetch API 如何获取响应体? 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01