How to install Couchbase for Node.js on a Windows 8 machine

Update: You’re reading the Couchbase Post of the Week!

Working Installation

This should be a working step-by-step installation. If you’re interested in a particular error or how I got to this steps please read the article below.

1. Make sure you have python >=2.5 and < 3.0 (eg 2.7) installed 2. Download and install libcouchbase (search for windows)
2b. Ensure that your folder structure matches the binding.gyp – (try to access C:\couchbase\bin\libcouchbase.dll in your explorer)
3. Download and install a C/C++ compiler (e.g. via Visual Studio Express for Win8)
4. Set path to python in your shell like so: set PYTHON=C:\Dev\Python27\python.exe
6. Run

(7.) If the gyp config does not match your visual studio edition use flags:

Tips for Mac Users

For additional information please refer to the node-gyp requirements page

Test it

Tugdual Grall has a simple test example on his page which unfortunately seems to be outdated. Here is a newer one:

I hope this helps some people out there 😉



Yesterday I tried to install the Couchbase drivers for Node.js on a Windows 8 machine and it was no fun for me.
Here are some of the errors and the solutions that finally resulted in a working driver compilation.

One more time it turned out that you have to know and understand your tools – in this case : GYP

Attempt #1 – the naive NPM way

My first error seemed to be a typical beginner problem. Since the whole Node.js environment was just set up the Python dependencies, needed for this module called “gyp”, were missing.

This post on stackoverflow describes the same problem in more detail.

So my next step was to install python 3.3.2 on the machine and to set the environment variable.
The next mistake I made was to name the variable not PYTHON but something like PYTHON_HOME.

Anyway, I made this changes and then tried to install the pure node-gyp:

which worked for me.

BTW node-gyp is a “cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js, which takes away the pain of dealing with the various differences in build platforms” (

Attempt #2 – with GYP installed

After the successful installation of gyp I tried to install couchbase again:

So the second try resulted in a “weird error” which is really encouraging for a node beginner like me 😉

It was time to follow the installation instructions on GitHub

To install this module, we’ll assume you are using NPM. However it is not as simple as a regular JavaScript module, as it depends on the C-library for Couchbase clients, libcouchbase.

– nice!

Attempt #3 – Building from Git

Ok, first I installed libcouchbase then cloned the repo, ‘cd’-ed into the directory and ran:

This caused me the same “weird” error…

Google helped me to find this page:

Yeah! someone had the same “weird” error.. So where is the solution? You might guess – no answer.

But I found a really helpfull blogpost on the site too, which is a detailed getting started / installation guide.

Attempt #4 – Tugdual Grall method

I followed the instructions on

Node-gyp will look for all the dependencies (DLL, library headers) into c:\couchbase directory, so you need to unzip the file in this folder. This location comes from the binding.gyp file of the couchnode project.

SERIOUSLY!? Since my file structure did not match with the one expected from binding.gyp I used symbolic links to recreate the required structure which seems to be

I did everything as described but it did not work, still had the same weird error.

Update 13.01.2014
If you’re experiencing a problem like:

Make sure you have copied the content(!) of libcouchbase without a subfolder into c:\couchbase. When you are able to access
in your explorer, your problems should be solved.

Attempt #5 – Solving Python – GYP conflict

With my next serach for the error I found this issues page:
Reading through the posts I realized that a lot of people experienced the same problem and that some of them solved it by setting the path variable manually!

I tried:

and in the same shell(!) executed

with the following result:

And even though it was just another error I felt good for the first time in this 3h “debugging” nightmare.
The next step was of course to downgrade my python version.
Foolish me thinking that the most recent version could work -.-

Next I downloaded and installed Python version 2.7.x

After a

I started a next attempt of running the npm installation routine:

Attempt #6 – Solving the C++ compiler conflict

This error resulted from a VisualStudio2012 installation which was already on the machine.
After some googling and reading I found this trick which worked for me:
Look for the post from “pfannery” it’s saying:

I had a similar issue with node-gyp, I have visual studio 2012 pro edition. The reason this error occurs is because node-gyp only looks for the VC 2012 express editions. So currently if express isn’t installed it fails on the msbuild task.
I’ve added a pull request which added checks for full visual studio 2012 (32&64bit).
Here is a useful tip for when you have multiple visual studio versions installed i.e vs2010 and vs2012.
Add the following environment variable (tells python what default version to use. i.e. 2010 or 2012 etc)

If you ever want to override the global GYP_MSVS_VERSION env var then run node-gyp and npm like this

Finally, running the command with the needed flags was successfull:

4 thoughts on “How to install Couchbase for Node.js on a Windows 8 machine

  1. yeah ! Thank you for the great post ! Was really helpful, also for me as a mac user ! Small tip for all who want to run Couchbase on Mac: check whether your Xcode components especially the ‘Command Line Tools’ are up to date before you start the installation!

  2. Node.js was not usable for me because the package code is installed at a file path of more than 256 characters long. I had to accordion the files paths to root just to delete them. Apparently, the developers are not interested in solving the problem for the Windows community, saying there is no problem with the file structure as it is. The best answer I received from people was to install Linux. That means that most of the code at github is useless to me including Bootstrap and Foundation. Do any of you know how I can use node.js? I would really like to know how to get it to work on my Win 8.1 boxes. I use IIS and MSSQL Express for hosting and coding.

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.