Browser-sync and node-gyp need some Vitamin C to run on Windows

Recently I had and issue with browser-sync on Windows. The problem came from node-gyp, a cross platform compiler that is integrated in Node.js. Exactly this module of Node.js was throwing an error that stated ‘Python is missing’ on Windows.
Actually the thing is a little bit more tricky and over the last couple of days I read many problems with node-gyp and Windows. Some mentioned to install Visual Studio Community Edition as well as other components found on the Microsoft Web Site.
The only thing Windows needs is just some Vitamin C in the form of a Visual C++.

Partially wrong documentation on

When you take a look on the browser sync documentation page it states that there are might some troubles with Windows. If you are running into the issue of your Windows update not downloading then click the link above to resolve the issues. The recommended workaround is to install Visual Studio because this will install the required Visual C++ runtime libraries. This library is used by the native build tool node-gyp.
The easiest way to get the runtime libraries installed is to install the so called “Microsoft Visual C++ Redistributable Package”. This installer has everything needed included. The latest Version can be found on the Knowledge Base article.
After this package have been installed everything works fine.

Testing procedure

To be honest. Whenever I tried to browser-sync or Yeoman generators on windows I always had Visual Studio installed too. In this case you don’t have troubles with with all that stuff and Visual C++ is already installed.
To reproduce the behavior mentioned above I installed a fresh new Windows 10 virtual machine and started to install from scratch.
First, I installed ‘Node.js’. I tested it with the mature and dependable version (Version 4.x.x) as well with the version that included the latest features (Version 5.x.x.) of ‘Node.js’.
After that I installed Git and Yeoman plus the default web application generator. Needless to say that this default generator includes browser sync as its core web server.
The I created the first project with this generator and guess what? I failed with the following error.

> bufferutil@1.2.1 install C:\test\webapp\node_modules\bufferutil

> node-gyp rebuild
C:\test\webapp\node_modules\bufferutil>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command “C:\\Program Files\\nodejs\\node.exe” “C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js” “rebuild”
gyp ERR! cwd C:\test\webapp\node_modules\bufferutil
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: node-gyp rebuild

Right after installing the latest Version of Visual C++ all the problems were gone. Because now browser sync found a C++ compile and a environment to run as mentioned on their web site.
Further updates of Visual C++ will be automatically installed through Windows update so nothing to worry about.

Visual C++ installed on Windows 10

Visual C++ installed on Windows 10


*** Update 1.2.2016 *** The problem come back when you use browser-sync without yeoman generators. The reason for this python message is because some optional components require python to be install but those components are not required to run browser-sync. This can be avoided if browser-sync will is installed through the following command.

npm install browser-sync --no-optional

node-gyp – do I need Python?

It depends. ‘node-gyp’ is a cross-platform command-line tool written in ‘Node.js’ for compiling native add-on modules for ‘Node.js’. It bundles the gyp project used by the Chromium team and takes away the pain of dealing with various differences in build platforms.
That is what the official Github project page of node-gyp says. The developers also recommend to install Python to use the full spectrum of node-gyp.
In case of browser-sync Python is not required because some dependencies will be compiled through C++ but not Python. If you are dealing with other projects Python might needs to be installed on Windows too.
From my perspective the origin of the error message comes from the fact that no C++ compiler could be found and node-gyp try  to compiled it with Python as the last option.
On Linux and OS X compiler for Python as well as C++ are integrated directly in the operation system.