简体   繁体   中英

how to install zeromq for node.js

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

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

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.

我没有查看该软件包中的最新更改,但我为自己的项目编写了https://github.com/matthiasg/zeromq-node-windows ,它们对zeromq-node项目进行了一些小的更改,使其在Windows中运行。正如它在自述文件中所述,我不提供支持,但也许这会让你开始?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM