Python MSBUILD:错误 MSB3428:无法加载 Visual C++ 组件“VCBuild.exe”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28621953/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 03:31:58  来源:igfitidea点击:

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe"

pythonrubynode.jsmsbuildnode-gyp

提问by Gags

I am trying to install nodejsfrom a long time now. I tried it searching over the google but seriously i had not got any working solutions.

我很nodejs长一段时间以来都在尝试安装。我尝试在谷歌上搜索,但严重的是我没有得到任何有效的解决方案。

My first question is that

我的第一个问题是

  1. Why Nodejs require Microsoft Visual component?
  1. 为什么 Nodejs 需要 Microsoft Visual 组件?

Secondly as per suggestion on google i tried below things

其次,根据谷歌的建议,我尝试了以下内容

  • Installed Visual C++ 2010 (updated path in the variable) but after installing i got many more errors including "MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".
  • Went through https://github.com/TooTallNate/node-gypfor getting errors removed but still it is not working.
  • Uninstalled and installed Node js again but with no success.
  • 安装了 Visual C++ 2010(变量中的更新路径),但安装后我遇到了更多错误,包括“MSBUILD:错误 MSB3428:无法加载 Visual C++ 组件“VCBuild.exe”。
  • 已通过https://github.com/TooTallNate/node-gyp删除错误,但仍然无法正常工作。
  • 再次卸载并安装 Node js,但没有成功。

I have following versions as

我有以下版本

  • Node js 0.12
  • Python 2.7
  • Ruby 1.9.3
  • Windows 7 64 bit.
  • 节点js 0.12
  • 蟒蛇 2.7
  • 红宝石 1.9.3
  • Windows 7 64 位。

When i run npm-installthen the error appears as below

当我运行时npm-install,错误显示如下

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 Visual Studio 2005 or 3) add the location of the 
component to the system path if it is installed elsewhere. 

My package.jsonis as below:

package.json的如下:

{
 "name": "TRest",
 "version": "0.1.0",
 "devDependencies": {
     "grunt": "~0.4.2",
     "grunt-contrib-watch": "~0.5.3",
     "grunt-sass": "~0.11.0",
     "grunt-pixrem": "^0.1.2",
     "grunt-legacssy": "^0.2.0",
     "grunt-contrib-concat": "~0.3.0",
     "grunt-contrib-uglify": "~0.3.2",
     "node-bourbon": "^1.0.0"
  }
}

采纳答案by Bertus Kruger

You can tell npm to use Visual studio 2010 by doing this...

您可以通过执行此操作告诉 npm 使用 Visual Studio 2010...

npm install socket.io --msvs_version=2010

Replace socket.io with the package that is giving the issue.

将 socket.io 替换为出现问题的包。

It is also possible to set the global settings for npm:

也可以为 npm 设置全局设置:

npm config set msvs_version 2010 --global

回答by kamalG

I was trying to install strongloop and got this error "MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe”. I was able to resolve by running this.

我正在尝试安装 strongloop 并收到此错误“MSBUILD:错误 MSB3428:无法加载 Visual C++ 组件“VCBuild.exe”。我能够通过运行它来解决。

find node on your windows with $ npm install -g which $ which node after cd into the directory, inside the directory cd into node_modules\npm folder and finally: $ npm install node-gyp@latest

使用 $ npm install -g which $ which node 在 cd 之后找到您的 windows 上的节点到目录中,在目录中 cd 到 node_modules\npm 文件夹中,最后: $ npm install node-gyp@latest

回答by Badr Bellaj

alternatively try npm install --global --production windows-build-tools

或者尝试 npm install --global --production windows-build-tools

回答by vnxyz

I personally got this because python2 path couldn't be fetched. You can either install python 2 and set the the path in environment variables or find a node-gyp module installed somewhere in your colleagues machine and just paste it in your node_modules folder.

我个人得到了这个,因为无法获取 python2 路径。您可以安装 python 2 并在环境变量中设置路径,也可以在您的同事机器中的某处找到安装的 node-gyp 模块,然后将其粘贴到您的 node_modules 文件夹中。

回答by MANJEET SINGH MEHTA

Use the PowerShell with administrative rights and run:

使用具有管理权限的 PowerShell 并运行:

npm install --global --production [email protected]

after that it will work smoothly.

之后它将顺利运行。