node.jsnpmnode-gypvcbuild

NPM install error - node-gyp


Trying to install xml-stream package but it keeps failing building dependencies. It seems to require vc2010(vcbuild.exe) but i installed the .Net Framework 2.0 SDK which has the vcbuild file and I'm getting the following error while installing xml-stream:

> node-expat@2.0.0 install G:\Pessoal\node\bugzilla\node_modules\xml-stream\node
_modules\node-expat
> node-gyp rebuild


G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-expat>node "D
:\Bin\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\
node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
  The following error has occurred during XML parsing:

  File: G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-expa
  t\build\deps\libexpat\expat.vcproj
  Line: 1
  Column: 4916
VCBUILD : error Message:  [G:\Pessoal\node\bugzilla\node_modules\xml-stream\nod
e_modules\node-expat\build\binding.sln]
  Erro de sistema: -2147154687.

  The file 'G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-
  expat\build\deps\libexpat\expat.vcproj' has failed to load.
gyp ERR! build error
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 (D:\Bin\nodejs\node_modules\npm\node_m
odules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\Bin\\nodejs\\node_modules\\npm\\node_modules\\node-
gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd G:\Pessoal\node\bugzilla\node_modules\xml-stream\node_modules\node-
expat
gyp ERR! node -v v0.10.30
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok

Solution

  • I believe this is happening because xml-stream depends on node-expat which depends on node-gyp which on windows will require you to either install VS2007 or in some other way install the correct SDK required by node-gyp.

    In my case I did not wish to jump through those hoops and found it easier to simply use sax to write a very simple XML parser with no dependency on node-gyp.
    I placed it on NPM: https://www.npmjs.com/package/no-gyp-xml-stream
    Or just run: npm install no-gyp-xml-stream

    It's still a work in progress but it works it's easy to use and it will allow you to read large XML files over a stream returning child elements via a call back. And it's only dependency is sax which will not require you to install anything.