Here you can find all the information you'll need to begin using Browsersync. We have extensive information covering command-line usage, the API, Grunt/Gulp integrations and all available options.
In this section:
If you would like to run Browsersync from the command line in any directory, it
can be installed
globally with the following command.
$ npm install -g browser-sync
This is the prefered way to use Browsersync - installing it locally to each project. This way the dependency can be added to your package.json file and everyone on your team.
$ npm install browser-sync --save-dev
Mac OSXand encounter problems when trying to install Browsersync - either globally or locally, it's almost always because you have problems with NPM permissions. Checkout their docs for a guide on how to fix this once and for all - it only takes 2 minutes :)
Browsersync works by injecting an asynchronous script tag (
<script async>...</script>) right after the
during initial request. In order for this to work properly the
<body> tag must be present. Alternatively you
can provide a custom rule for the snippet using snippetOptions
Having trouble installing Browsersync on Windows? The most common reason for
npm to throw
errors when compiling Browsersync is that some of the dependencies
(e.g. node-gyp need Visual C++ runtime libraries.
The way to resolve this is to install Visual Studio.
At the time of this writing (Feb 2015) the compilation works fine with
Visual Studio 2013 Update 4.
You can then tell
npm which version of Visual Studio you are using by the following command:
npm install -g browser-sync --msvs_version=2013
After installation of Visual Studio
npm should not throw errors any longer, but only issue warnings.
As far as we can tell, they do not impact Browsersync.
Sometimes, depending on your network, your OS will report multiple external IP addresses. If this happens, currently Browsersync just picks the first one and hopes for the best.
This site is open source on Github & we welcome corrections/improvements.