使用浏览器同步时,为什么浏览器说无法获取,而一切似乎都很好

When using browser-sync,why is the browser saying cannot get, while everything seems fine

这是cmd的截图:

我写了

browser-sync start --server --files "app\index.html"

查看您的屏幕截图,您的项目目录似乎位于 Desktop 文件夹中,其结构如下:

confusion
│
└───app
    │
    └───index.html

在这种情况下,您可以尝试指示 Browsersync 从 app 目录启动服务器。如果您 cd 到名为 confusion 的文件夹,则 运行:

browser-sync start --server "app" --files "app/index.html"

注意在 --server 标志后添加 "app"