node.js - npm 安装 xml2json 报错

标签 node.js npm npm-install node-expat

在 Windows cmd 中运行 npm install xml2json 时出现错误

解决了 python 和 .net 依赖问题,但卡在“ fatal error C1060:编译器堆空间不足”

无法安装在我整个windows系统的任何node js项目中

npm install simple-xml2json & parallel-xml2json are working fine

>npm install xml2json --save request
npm WARN package.json @ No description
npm WARN package.json @ No repository field.
npm WARN package.json @ No README data
npm WARN package.json @ No license field.
-
> node-expat@2.3.13 install xxxxxxxxxxxxxxxxxxxxxxxxxxx\xml2json\node_modules\node-expat
> node-gyp rebuild


xxxxxxxxxxxxxxxxxxxxx\xml2json\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Program Files\nodej
s\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.
  xmlparse.c
  xmltok.c
  xmlrole.c
  win_delay_load_hook.c
..\..\..\deps\libexpat\lib\xmlparse.c(1844): warning C4244: 'return' : conversion from '__int64' to 'XML_Index', possible loss of data [xxxxxxxxxxxx\xml2json\node_modules\node-expat\build\deps\libexpat\expat.vcxproj]
  expat.vcxproj -> xxxxxxxxxxxxxxxx\xml2json\node_modules\node-expat\build\Release\\libexpat.lib
  node-expat.cc
xxxxxxxxxxxxxxxxxx\xml2json\node_modules\node-expat\node_modules\nan\nan.h(72): fatal error C1060: compiler is out
of heap space [xxxxxxxxxxxxxxxxxxxxxxxxxx\xml2json\node_modules\node-expat\build\node_expat.vcxproj]
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 (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 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebui
ld"
gyp ERR! cwd xxxxxxxxxxxxxxxxxxxxxxxxxxxxxs\xml2json\node_modules\node-expat
gyp ERR! node -v v4.4.3
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "xml2json" "--save" "req
uest"
npm ERR! node v4.4.3
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! node-expat@2.3.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.13 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project               >with:
npm ERR!     npm bugs node-expat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

最佳答案

一些基于 C/C++ 库的库需要在操作系统上安装额外的库。有时甚至 yarn 也需要额外的权限才能添加此类库。

关注this安装额外依赖项的指南。或者使用一些其他的 XML 到 JS/JSON 解析器库,比如 fast-xml-parser这是纯粹基于 JS 正则表达式。

关于node.js - npm 安装 xml2json 报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37341788/

相关文章:

node.js - npm 依赖项是否需要其父包中的模块

node.js - 在 Node 中将 ieee754 转换为十进制

node.js - 在 npm install 之前删除 node_modules?

node.js - npm 安装 google-cloud 失败

npm - NPM 包安装失败

npm - 从本地目录加载 npm 包,无需复制不必要的文件/文件夹,例如 node_modules

node.js - 使用 node js 返回所有带有过滤文件的文件

javascript - Strapi Beta (3.0) 的自定义 Controller 代码

node.js - 使用 MongoDB 存储通知(以及读取状态)

javascript - 条件 Jade 模板,用户登录