BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.18k stars 755 forks source link

npm run browser-sync on windows doesn't work #945

Open maximilianschmitt opened 8 years ago

maximilianschmitt commented 8 years ago

I have a project where I'm configuring my build steps through package.json scripts.

The following line for browser-sync:

"server": "browser-sync start --port 3000 --files 'dist/**/*' --server 'dist' --directory"

It works fine on OSX for me, but if my buddy runs npm run server on Windows 10 and opens localhost:3000, he just sees the Express Cannot GET /.

However, if he runs ./node_modules/.bin/browser-sync start --port 3000 --files 'dist/**/*' --server 'dist' --directory directly (not through npm) and opens localhost:3000 he gets a directory listing of the dist directory as expected.

node v5.3.0, npm v.3.3.12, browser-sync v2.10.1 and using git bash (cygwin didn't make a difference).

What could be causing this issue and how do we get around it?

mstaessen commented 8 years ago

Not sure if related, but on my machine, I cannot seem to proxy another server. BS starts, admin panel works, but proxy requests all hang. localhost:3000 does not respond.

Same setup: Windows 10 Pro, node 5.3, bs 2.10.1

chelder86 commented 8 years ago

I'm also getting the Cannot GET / If I run that command directly, it does not work either. I'm on Windows 7. I have Visual Studio 2015 (not 2013). I also have Cygwin installed. It does work well in Ubuntu.

hanislovingit commented 8 years ago

I have similar issue. I am running on Windows 10, VS 2015 Update 1. Node v4.3.1, npm v2.14.12.

shakyShane commented 8 years ago

This is likely an npm issue rather than a Browsersync one

codylindley commented 8 years ago

Anyone figure this out. I'm having the same issue. Works fine on mac. Works fine when not using 'npm run'.

codylindley commented 8 years ago

So, this does not work on windows.

  "scripts": {
    "dev-server": "browser-sync --port 4000 --server 'dev-server' start --files 'dev-server/**/*.html,dev-server/**/*.css,dev-server/**/*.js' "
  },

but this does.

  "scripts": {
      "dev-server": "browser-sync --port 4000 --server \"dev-server\" start --files \"dev-server/**/*.html\" \"dev-server/**/*.css\" \"dev-server/**/*.js\" "
  },

Notice how I have to escape all of the ' with \".