0

I have tried to install node-protobuf on win10 a few days now. I have followed a few quides/readmes, how to to it, but there is no success. Now I'm stuck here:

 C:\rie>npm install node-protobuf
/
> node-protobuf@1.3.3 install C:\rie\node_modules\node-protobuf
> node-gyp rebuild


C:\rie\node_modules\node-protobuf>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  init.cpp
  native.cpp
  parse.cpp
  serialize.cpp
c:\rie\node_modules\node-protobuf\src\common.h(11): fatal error C1083: Cannot open include file: 'google/protobuf/descriptor.h': No suc
h file or directory (compiling source file ..\src\native.cpp) [C:\rie\node_modules\node-protobuf\build\protobuf.vcxproj]
c:\rie\node_modules\node-protobuf\src\common.h(11): fatal error C1083: Cannot open include file: 'google/protobuf/descriptor.h': No suc
h file or directory (compiling source file ..\src\serialize.cpp) [C:\rie\node_modules\node-protobuf\build\protobuf.vcxproj]
c:\rie\node_modules\node-protobuf\src\common.h(11): fatal error C1083: Cannot open include file: 'google/protobuf/descriptor.h': No suc
h file or directory (compiling source file ..\src\parse.cpp) [C:\rie\node_modules\node-protobuf\build\protobuf.vcxproj]
c:\rie\node_modules\node-protobuf\src\common.h(11): fatal error C1083: Cannot open include file: 'google/protobuf/descriptor.h': No suc
h file or directory (compiling source file ..\src\init.cpp) [C:\rie\node_modules\node-protobuf\build\protobuf.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\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:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\rie\node_modules\node-protobuf
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-protobuf"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! code ELIFECYCLE

npm ERR! node-protobuf@1.3.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-protobuf@1.3.3 install script 'node-gyp rebuild'.

On centos, there is no problem.

ajlind
  • 185
  • 1
  • 2
  • 18

1 Answers1

0

I guess you didn't read the document well, to install this package you need some tools and configuration done on your end.

First you have to obtain Microsoft Visual C++ 2010. Express is fine, but if you install SP1 then you'll need to reinstall x64 compilers from here. Node.js distribution for Windows already includes node-gyp tool, so you don't need to worry about it. VC++ 2012/2013 should work as long as you have compiler version compatible with your Node.js installation (i.e. 64 for 64 and 32 for 32). For any problems compiling native modules on Windows consult node-gyp repository.

Next, compile libprotobuf. Get it from Google, open vsprojects/protobuf.sln and compile it according to your OS version. For Windows 64 you must compile 64-bit library as Node.js is 64-bit on your system. By default there is only 32-bit target, so you have to add 64-bit manually. Open libprotobuf project properties and set CRT to Multi-Threaded (not DLL). Compile libprotobuf Release.

Next, run vsprojects/extract-includes.bat, it will copy required headers in vsprojects/include.

Create LIBPROTOBUF environment variable pointing to some folder where you'll put libprotobuf files. You can use SET LIBPROTOBUF=path from command line prompt, or use tool like RapidEE. Put libprotobuf.lib to $(LIBPROTOBUF)/lib and include files to $(LIBPROTOBUF)/include. You're done.

Now just npm install node-protobuf and it should be fine.

Still facing the issue, then make sure all the above are installed and done, then check your internet connectivity once..

Prasanth Jaya
  • 4,407
  • 2
  • 23
  • 33
  • I think, ms-tools are ok. I have installed MS Visual c++ Build Tools with "npm install --global --production windows-build-tools". Problem is maybe "compile libprotobuf.". I can find it, but how to compile it? – ajlind Aug 05 '16 at 18:33