4

尝试安装 xml-stream 包,但它始终无法构建依赖项。它似乎需要 vc2010(vcbuild.exe) 但我安装了具有 vcbuild 文件的 .Net Framework 2.0 SDK,并且在安装 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
4

1 回答 1

1

我相信这种情况正在发生,因为xml-stream取决于node-expat哪个取决于node-gyp哪个 Windows 将要求您安装 VS2007 或以其他方式安装node-gyp.

就我而言,我不希望跳过这些障碍,并发现简单地使用它sax来编写一个非常简单的 XML 解析器而不依赖于node-gyp.
我把它放在NPM上:https
://www.npmjs.com/package/no-gyp-xml-stream 或者只是运行:npm install no-gyp-xml-stream

它仍在进行中,但它很容易使用,它允许您通过回调通过返回子元素的流读取大型 XML 文件。它唯一的依赖是sax不需要你安装任何东西。

于 2016-11-21T05:30:16.103 回答