how to install zeromq for node.js

Problem

I want to install zeromq for node.js in Windows 7 64-bit. I tried with

npm install zmq

It gave phython.exe is missing. After installing that python (2.7.3).
Again it gave some build error, which is as follows:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1

Problem courtesy of: Raj

Solution

Update 1

Improvements were made, now npm install zmq works, but you still need Win SDK 7 and VS C++ 2010, I think.

Original Answer

Unfortunately npm install zmq still don't work, but you can install it from local repo.

mscdex forked the zeromq.node repo, and added windows support, so just clone his zeromq.node

But before build you need some prerequisites:

Run the Windows SDK 7.1 Command Prompt from Start menu / Microsoft Windows SDK v7.1

go to the cloned directory, and type

node-gyp configure
node-gyp build

this should work on windows 7 64bit. I cloned zeromq.node into my node project dir, so in my app.js i could require('./zeromq.node').

Solution courtesy of: balazs

Discussion

The latest update:

Windows 8.1, node v4.4.5, npm v3.10.5

  1. Ensure python2 environment as usual
  2. Install Windows SDK (mine 8.1)
  3. Install VS2015 Community and select Common Tools for Visual C++
  4. ===> npm -g install npm@next see this
  5. npm install --msvs_version=2015 zmq

Note: I can't build with vs2012 anymore and all the suggested above not working with build error error c2240 cannot convert from 'v8::Value *' to 'v8:object *volatile'. Maybe because of the newer nodejs v4.4.5 (someone can clarify this?).

However using vs2015 produce build error win_delay_load_hook.c(34): error C2373: '__pfnDliNotifyHook2'. I fix this using npm@next as mentioned above.

Discussion courtesy of: CallMeLaNN

I had alot of trouble myself and eventually got it installed after hours of reading and trying diff things out:

  1. Install python. Make sure Python 2.7.x installed and not 3.x (i used https://www.python.org but cygwin's python might work too) Confirm by running below:

    $ python -V Python 2.7.9

  2. set PYTHON env variable, whereever you installed it (or cygwin's bin directory if installing python that way):

    PYTHON=C:\dev\python\python.exe

  3. Set what folder python.exe added onto your PATH variable:

    PATH=C:\dev\python\;

  4. needed this node-gyp installed manually:

    $ npm install -g node-gyp ... Got slightly further...

  5. So I quit with trying to get it to install with my current Visual C++ 2010 and got Visual C++ 2012 to work (think 2013 may work too): so installed 'Visual Studio 2012 Express for Windows Desktop'
    Should install the '2012 Visual C++ Redistributables' (if not, install separately).

    Also had 'Windows7 SDK' already installed per balazs instructions so probably need that too.

    Now try on Windows command line and specify the version to use:

    $ npm install --msvs_version=2012 zmq and it worked!

    Note: wanted to mention what I already had installed. Already had 'Visual Studio C++ 2010 Express' installed (which installed Visual C++ 2010 Redistributables) and Windows7 SDK since I was kinda following balazs instructions above.

    Then I tried installing: 'Microsoft Visual Studio 2010 Service Pack 1' 'Visual C++ SP1 Compiler Update for Windows SDK 7.1'

    Since none of that 2010 worked, I went with 2012. Maybe someone can figure out if possible to make it work with C++ 2010.

Discussion courtesy of: armyofda12mnkeys

I did not look into recent changes in that package but I wrote https://github.com/matthiasg/zeromq-node-windows for our own projects which added minor changes to the zeromq-node project to make it work in Windows... as it says in the readme I don't offer support , but maybe that will get you started ?

Discussion courtesy of: mgoetzke

This thread was very useful, here's what worked for me today on Win10:

  1. Download / install zmq binaries for windows
  2. Download / install node.js for windows
  3. Get miniconda2 or similar in case you have python3 (python 2 required for the steps below build)
  4. Get VS 2013 (any version should do) VS '15 doesn't work at this time
  5. From a python2 prompt: npm install --msvs_version=2013 zmq
Discussion courtesy of: bigonazzi

This recipe can be found in it's original form on Stack Over Flow.