1

I just installed browser-sync but when I try to start a server I get this error:

      terkea@terkea-Lenovo-G50-80:~$ browser-sync start --server --files index.html[Browsersync] Access URLs:

   Local: http://localhost:3000
External: http://192.168.1.3:3000
------------------------------------
      UI: http://localhost:3001
UI External: http://192.168.1.3:3001
------------------------------------

[Browsersync] Serving files from: ./ [Browsersync] Watching files...

Maybe someone could find what's wrong and help me please?

Terchila Marian
  • 2,225
  • 3
  • 25
  • 48

3 Answers3

0

You probably need to pass an argument to --server which is the directory from which you want to serve the files from. Browser-sync uses your current working directory by default.

So for example, if you're starting browser-sync in the root directory of your project, and your index.html is in folder a/b/c/index.html, then the browser-sync command will be:

browser-sync start --server "a/b/c/" --files "index.html"
0

You must specify the folder in which your files are located. I use ubuntu 18.04 and it works. For example, if you want to open all files in directory /home/user/code you must write this command:

browser-sync start --server "/home/user/code/" --files "*.*"
Harshal Yeole
  • 4,812
  • 1
  • 21
  • 43
Stepan K.
  • 185
  • 2
  • 8
  • *UPD:* a small correction - works correctly only if you advance to the project's layout and start the program from there. example: `cd /home/user/code browser-sync start --server --files "*.*"` – Stepan K. Jun 22 '18 at 10:56
0

I just used browser-sync for the first time and experienced the same problem. I was expecting it to serve a directory listing like http-server does but that only happens if you add the --directory flag. Otherwise if you want it to open a specific file then specify it with --index.

  • browser-sync start --server --directory serves a directory listing
  • browser-sync start --server --index "test.html" serves test.html
Steve Crane
  • 4,340
  • 5
  • 40
  • 63