gpt4 book ai didi

node.js - 使用 node.js 安装 xml2json 时出错

转载 作者:搜寻专家 更新时间:2023-10-31 22:47:47 27 4
gpt4 key购买 nike

我试图为 node.js 安装 xml2json 包,但它给了我错误。

错误如下:enter image description here

我的系统配置如下:

node.js 版本 - v5.4.1

npm 版本 - 3.3.12

操作系统 - windows 10 64 位

python - 2.7.11(设置为环境变量)

安装 microsoft windows sdk v7.1 后出现以下错误。

enter image description here

添加 package.json 后出现以下错误。

enter image description here

最佳答案

在使用 msbuild(由 node-gyp rebuild 触发)构建时,您必须明确指定平台工具集。在运行 npm 之前尝试下面的命令:

call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64

请参阅下面传递参数的含义,来自 SetEnv.cmd Usage :

/Release - Create a Release configuration build environment

/x64 - Create 64-bit x64 applications

补充说明

npm install xml2json 需要使用 Windows SDK在引擎盖下构建项目,同时安装包,使用 MSBuild .您遇到过您的 Windows SDK 配置与 node 要求不兼容的情况。

Configuring the Windows SDK Command Prompt Window部分:

If you do not have Visual Studio 2010, you can use the Windows SDK Command Prompt window and the SetEnv utility to configure your application build settings.

所以我的建议是使用SetEnv 工具来解决你的问题......

解决问题的其他方法

MSBuild 使用 VCTargetsPath 属性,该属性无法定位,因为注册表缺少此键。

检查key是否存在并指向正确的路径

  1. 启动 regedit Navigator 以HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\WinSDKVersion
  2. 检查 VCTargetsPath 键。该值应为“$(MSBuildExtensionsPath64)\Microsoft.Cpp\WinSDKVersion\”

如果键不存在或值错误,请按以下步骤解决问题:

  1. 启动 regedit Navigator 以HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\WinSDKVersion
  2. 添加字符串键VCTargetsPath
  3. 将值设置为“$(MSBuildExtensionsPath64)\Microsoft.Cpp\WinSDKVersion\”

WinSDKVersion == v4.0(看起来这是您的 WinSDK 版本的值(value)),因此将 WinSDKVersion 替换为 v4.0

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

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com