NPM 安装错误 - node-gyp [英] NPM install error - node-gyp

查看:141
本文介绍了NPM 安装错误 - node-gyp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试安装 xml-stream 包,但它一直无法构建依赖项.它似乎需要 vc2010(vcbuild.exe),但我安装了 .Net Framework 2.0 SDK,其中包含 vcbuild 文件,并且在安装 xml-stream 时出现以下错误:

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

推荐答案

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

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.

在我的例子中,我不想跳过这些问题,我发现简单地使用 sax 来编写一个非常简单的 XML 解析器而不依赖于 node-gyp.
我把它放在 NPM 上:https://www.npmjs.com/package/no-gyp-xml-stream
或者直接运行:npm install no-gyp-xml-stream

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

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

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.

这篇关于NPM 安装错误 - node-gyp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆