当前位置: 首页 > 知识库问答 >
问题:

错误:找不到模块“xml2json”

高功
2023-03-14

当运行我的项目包时,我有上面的标题错误,在我试图使用

npm安装xml2json

但是,我只有以下错误,你能给我建议或想法,从这个问题中走出来吗...

D:\xampp\htdocs\podio>npm install xml2json

> node-expat@2.3.16 install D:\xampp\htdocs\podio\node_modules\node-expat
> node-gyp rebuild


D:\xampp\htdocs\podio\node_modules\node-expat>if not defined npm_config_node_gyp
 (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo
dules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Warning: Missing input files:
D:\xampp\htdocs\podio\node_modules\node-expat\build\deps\libexpat\..\..\..\deps\
libexpat\version.c
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".
 To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visua
l Studio 2005 or 3) add the location of the component to the system path if it
is installed elsewhere.  [D:\xampp\htdocs\podio\node_modules\node-expat\build\b
inding.sln]
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:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:219:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\xampp\htdocs\podio\node_modules\node-expat
gyp ERR! node -v v6.11.5
gyp ERR! node-gyp -v v3.4.0
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"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! node-expat@2.3.16 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.16 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\xampp\htdocs\podio\npm-debug.log

编辑:: 1

在我安装了更新的Visual Studio 2005到2012后,当我运行npm安装xml2json和npm安装xml2json--unsece-perm时,我得到下面的错误,

C:\Users\Desktop\New folder\action>npm install xml2json

> node-expat@2.3.16 install C:\Users\Hoffensoft\node_modules\node-expat
> node-gyp rebuild


C:\Users\Hoffensoft\node_modules\node-expat>if not defined npm_config_node_gyp (
node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modu
les\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Warning: Missing input files:
C:\Users\Hoffensoft\node_modules\node-expat\build\deps\libexpat\..\..\..\deps\li
bexpat\version.c
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
c:\users\hoffensoft\node_modules\node-expat\deps\libexpat\lib\siphash.h(201): w
arning C4244: 'initializing' : conversion from '__int64' to 'char', possible lo
ss of data (..\..\..\deps\libexpat\lib\xmlparse.c) [C:\Users\Hoffensoft\node_mo
dules\node-expat\build\deps\libexpat\expat.vcxproj]
  win_delay_load_hook.cc
  expat.vcxproj -> C:\Users\Hoffensoft\node_modules\node-expat\build\Release\\l
  ibexpat.lib
  node-expat.cc
  win_delay_load_hook.cc
C:\Users\Hoffensoft\node_modules\nan\nan.h(75): fatal error C1060: compiler is
out of heap space (..\node-expat.cc) [C:\Users\Hoffensoft\node_modules\node-exp
at\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:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:219:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Hoffensoft\node_modules\node-expat
gyp ERR! node -v v6.11.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Hoffensoft\pac
kage.json'
npm WARN Hoffensoft No description
npm WARN Hoffensoft No repository field.
npm WARN Hoffensoft No README data
npm WARN Hoffensoft No license field.
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"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! node-expat@2.3.16 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.16 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Hoffensoft\Desktop\New folder\action\npm-debug.log

提前感谢,戈帕尔·R

共有2个答案

邹华皓
2023-03-14

我已经解决了这个问题。如果您注意到命令的这一部分,我认为发生的情况是,如果未将npm\u config\u node\u gyp定义为false,则错误地将计算为false,并尝试不运行任何内容而不是运行node gyp。您需要做的是定义npm\u config\u node\u gyp变量。您可以这样做:export npm\u config\u node\u gyp=

编辑:在我的修复之后还有一个步骤。在执行我的代码时,expat绑定丢失。要修复此问题,请将bin文件夹和节点gyp可执行文件添加到npm\u config\u node\u gyp变量中,并在node\u modules\node expat文件夹中运行node gyp rebuild。e、 g.export npm\u config\u node\u gyp=C:\\Users\\781990\\AppData\\Roaming\\nvm\\v6.11.0\\node\u modules\\node gyp\\bin\\node gyp.jscd node\u modules\node expatnode gyp rebuild

苏华藏
2023-03-14

我已经解决了这个问题
使用这个命令npm安装xml2json-light
并更改let parser=要求('xml2json');let parser=要求('xml2json-light');
它对我有效

 类似资料:
  • 问题内容: 我已经很长时间没有使用Node.js了,也从未使用过express。当我启动应用程序时,它刚刚返回: 启动test.html时发生错误。这是代码: 我自己的路 : 为什么呢 编辑: 这是我的新app.configure: 但它返回: 问题答案: 我假设test.html是一个静态文件。要渲染静态文件,请像这样使用静态中间件。 这告诉express在应用程序的公共目录中查找静态文件。 指

  • 我刚刚开始使用webpack,很难获得多入口点示例来构建。网页包。配置。示例中的js文件包括以下行 这对我来说是个错误 在四处搜索时,我找到了将CommonChunkPlugin与表达式一起使用的其他示例 失败并出现错误 进一步搜索发现了许多示例,包括 我的构建现在失败了 我不知道该如何进行。

  • 运行command:时,出现以下错误: 错误输出:module.js:339 throw err;^错误:在Function.module._resolveFileName(module.js:337:15)在Function.module._load(module.js:287:25)在module.require(module.js:366:17)在require(module.js:385:

  • 问题内容: 我的Node应用程序在本地运行良好,但是在部署到Heroku时遇到错误。该应用程序使用Sequelize在一个文件夹,其中包含,和。在本地,我可以使用中的以下代码导入模型: 这很好,但是,当我部署到Heroku时,应用程序崩溃并显示以下错误: 最初我以为是由于区分大小写(本地mac与heroku linux),但是我移动了文件,进行了git commit,然后又移回并再次提交,以确保在

  • 我的系统似乎不愿意找到mysql模块。在尝试allot之后,我仍然得到Modulenotfound错误:没有名为MySQL的模块。这是我到目前为止所做的: 1. 2. 这似乎不起作用,所以我做了以下操作: 但这似乎也不起作用。 此外,我的系统似乎找不到mysql-connector-python-rf 有什么可能出问题的猜测吗?

  • 问题内容: 我写了我的第一个node.js应用程序,但是找不到快速库: 但是express已安装(带有密钥): 一些信息: 我怎么解决这个问题?( 必须 安装时不带吗?) 问题答案: 您需要在本地将Express安装到应用程序(文件夹)的上下文中: 原因是应用程序总是在其本地上下文中查找任何依赖项。全局安装仅用于设置系统范围内的可用二进制文件,例如单元测试运行程序或引导程序或类似的东西。 使用Ex