Funny Frontend Funny Frontend - 1 month ago 23
Node.js Question

BrowserSync Cannot GET /

I only have installed NodeJS and BrowserSync with this command:

npm install -g browser-sync


After I use this command to start the server:

C:\xampp\htdocs\browser_sync
λ browser-sync start --server
[BS] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.1.223:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://192.168.1.223:3001
--------------------------------------
[BS] Serving files from: ./


And I get the following error:
Cannot GET /

I'm confused because I want to use BrowserSync with my Laravel project.

Where should I install BrowserSync?

Thanks.

Answer

Using BrowserSync as a server only works if you're running a static site, so PHP won't work here.

Looks like you're using XAMPP to serve your site, you can use BrowserSync to proxy your localhost.

Example:

browser-sync start --proxy localhost/yoursite

References:

Comments