Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install zeromq for node.js

Tags:

node.js

zeromq

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

like image 616
Raj Avatar asked Dec 25 '12 09:12

Raj


3 Answers

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:

  • Microsoft Visual Studio C++ 2010 (Express is fine)

  • Microsoft Windows SDK for Windows 7

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').

like image 72
balazs Avatar answered Oct 31 '22 19:10

balazs


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.

like image 4
armyofda12mnkeys Avatar answered Oct 31 '22 20:10

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 ?

like image 1
mgoetzke Avatar answered Oct 31 '22 18:10

mgoetzke