npm install zmq issue

2019-08-04 01:13发布

问题:

I am doing npm install zmq but stuck in strange error, please see below

C:\Users\Administrator>npm install zmq

MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available too ls versions are "4.0".

gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1

gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\ npm\node_modules\node-gyp\lib\build.js:267:23)

gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)

gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789: 12)

googled but with no luck. this is a fresh install on windows server 2012. and zmq is already installed using windows msi installer, but i want to use zmq under nodejs so doing npm. i think msbuild is failing as node is assuming version 2 of .net framework, however installed .net version is 4. can any one please guide me how to solve the issue - thanks

regards zishan

回答1:

right, thanks Gustav, I solved it by installing visual studio 2012. first I changed the .net version from 4 to 2 by going to server manager, than I got another error where it says the system requires .net v2 sdk then i installed the sdk and finally visual studio 2012 of 5 gb. problem solved but i am amazed why we have to install 5 gb of vs to make zmq work, can it not be done only by linking the required dll or library, why it requires whole bunch of vb files! any ways its done.



回答2:

"npm install zmq" requires Visual Studio 2013 or less, Python 2.7.x

If you have multiple versions of Visual Studio, run this script to make 2013 as default :-
set gyp_msvs_version=2013

or you can try this other official package - "zeromq"

with zeromq, you don't have to worry about all the binaries. It comes with pre-build binaries for win(32/64), Linux(64), OS X/ Darwin(64 bit)

"npm install zeromq"