简体   繁体   English

浏览器同步不再有效

[英]Browsersync no longer works

I'm learning Laravel in combination with Vue and I installed Browsersync to make the process smoother.我正在结合 Vue 学习 Laravel,我安装了 Browsersync 以使过程更顺畅。 When I first installed it worked flawlessly.当我第一次安装它时,它完美无缺。

My setup is the following:我的设置如下:

  • Browsersync installed locally with npm i browser-sync --save-dev使用npm i browser-sync --save-dev在本地安装 Browsersync
  • Project location: C:\\WEB\\project_folder\\项目位置: C:\\WEB\\project_folder\\
  • php -S localhost:8000 -t public to serve the app. php -S localhost:8000 -t public为应用程序提供服务。 If I go to localhost:8000 it works as expected如果我去localhost:8000它会按预期工作
  • added mix.browserSync({proxy: 'localhost:8000', browser: "C:\\\\Program Files (x86)\\\\Google\\\\Chrome Beta\\\\Application\\\\chrome.exe", notify: false});添加mix.browserSync({proxy: 'localhost:8000', browser: "C:\\\\Program Files (x86)\\\\Google\\\\Chrome Beta\\\\Application\\\\chrome.exe", notify: false}); in webpack.mix.jswebpack.mix.js
  • npm run watch to build and run Browsersync npm run watch来构建和运行 Browsersync

Strange thing is that the Browsersync UI works properly if I acces localhost:3001 , even from another device in the network.奇怪的是,如果我访问localhost:3001 ,即使是从网络中的另一台设备,Browsersync UI 也能正常工作。

I observed it wasn't working anymore while creating another project where I use Parcel for bundling instead of webpack/laravel-mix.我观察到它在创建另一个项目时不再起作用,在该项目中我使用 Parcel 进行捆绑而不是 webpack/laravel-mix。 There I use the Browsersync CLI, running .\\node_modules\\.bin\\browser-sync start --proxy localhost:8000 --no-notify --cwd 'C:\\WEB\\project_folder' -f 'public'在那里我使用 Browsersync CLI,运行.\\node_modules\\.bin\\browser-sync start --proxy localhost:8000 --no-notify --cwd 'C:\\WEB\\project_folder' -f 'public'

I did not update Node, npm or the OS in the meantime.在此期间,我没有更新 Node、npm 或操作系统。 The only thing I installed is the game Valorant which has some fancy anti cheat service that is installed, but I disabled that service.我唯一安装的是游戏 Valorant,它安装了一些花哨的反作弊服务,但我禁用了该服务。

I tried:我试过:

  • multiple browsers and devices多个浏览器和设备
  • switching the order in which I start the server and Browsersync切换我启动服务器和 Browsersync 的顺序
  • the development folder was on another partition and I recently moved it to C: so I tried moving the project in the previous location开发文件夹在另一个分区上,我最近将它移动到 C: 所以我尝试将项目移动到以前的位置
  • thinking really hard about the meaning of life :)认真思考生命的意义:)

I guess next time I will use Docker to have a isolated environment.我想下次我会使用Docker来拥有一个隔离的环境。

I'm stumped.我难住了。 Any ideas?有任何想法吗? Have anyone encountered and solved this?有没有人遇到并解决过这个问题?

This was possibly caused by Windows.这可能是由 Windows 引起的。 I've installed kb4571744 and everything works again.我已经安装了 kb4571744 并且一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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