NPM安装错误 – node-gyp

尝试安装xml-stream包,但它保持失败的构build依赖关系。 它似乎需要vc2010(vcbuild.exe),但我安装了.Net Framework 2.0 SDK,它具有vcbuild文件,并且在安装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 

我相信这是因为xml-stream依赖于node-expat ,而node-expat依赖于node-gyp ,在windows上这需要你安装VS2007,或者以其他方式安装node-gyp gyp所需的正确SDK。

在我的情况下,我不想跳过这些箍,发现简单地使用sax编写一个非常简单的XMLparsing器而不依赖于node-gyp更容易。
我把它放在NPM上 : https : //www.npmjs.com/package/no-gyp-xml-stream
或者运行: npm install no-gyp-xml-stream

这仍然是一个正在进行的工作,但它的工作原理很容易使用,它将允许您通过stream读取大的XML文件,通过callback返回子元素。 只有依赖是sax不会要求你安装任何东西。

Interesting Posts