node.js npm 安装错误 - MSB3428:无法加载 Visual C++ 组件“VCBuild.exe”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21658832/
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-09-02 16:50:09  来源:igfitidea点击:

npm install error - MSB3428: Could not load the Visual C++ component "VCBuild.exe"

node.js

提问by prk

I'm trying to use the

我正在尝试使用

npm install steam

but I am getting an error saying

但我收到一条错误消息

error

错误

I'm not sure how to fix this and I have gotten this on two different npm module installs. I can install other modules however.

我不知道如何解决这个问题,我已经在两个不同的 npm 模块安装中得到了这个。但是我可以安装其他模块。

What I have tried: Install whatever dependencies it needs. (ursa, node-gyp etc) Install Visual C++ 2005. Install Visual C++ 2010. Change the enviroment variable path to /VC/ (found on another StackOverflow thread/question. Googled, googled & googled.

我尝试过的:安装它需要的任何依赖项。(ursa、node-gyp 等)安装 Visual C++ 2005。安装 Visual C++ 2010。将环境变量路径更改为 /VC/(在另一个 StackOverflow 线程/问题上找到。谷歌搜索、谷歌搜索和谷歌搜索。

I also get an error trying do:

尝试执行时我也遇到错误:

npm install ursa

The error is:

错误是:

error2

错误2

回答by Matt

Try this from cmd line as Administrator

管理员身份从 cmd 行尝试此操作

optional part, if you need to use a proxy:

可选部分,如果您需要使用代理:

set HTTP_PROXY=http://login:password@your-proxy-host:your-proxy-port
set HTTPS_PROXY=http://login:password@your-proxy-host:your-proxy-port

run this:

运行这个:

npm install -g --production windows-build-tools

No need for Visual Studio. This has what you need.

不需要 Visual Studio。这有你需要的。

References:

参考:

https://www.npmjs.com/package/windows-build-tools
https://github.com/felixrieseberg/windows-build-tools

https://www.npmjs.com/package/windows-build-tools
https://github.com/felixrieseberg/windows-build-tools

回答by Edu Ruiz

I know it's a very old question, but is the first in my google search and after some time I got how to solve this.

我知道这是一个非常古老的问题,但它是我谷歌搜索中的第一个问题,一段时间后我知道如何解决这个问题。

find node on your windows with
$ npm install -g which
$ which node
after cdinto the directory, inside the directory cdinto node_modules\npm folder and finally:
$ npm install node-gyp@latest
here worked, the answer is from this site

在 Windows 上找到节点,
$ npm install -g which
$ which node
然后cd进入目录,在目录中cd进入 node_modules\npm 文件夹,最后:
$ npm install node-gyp@latest
here work ,答案来自这个站点

回答by nsdevaraj

It's mentioned in the Documentation clearly as below: https://github.com/nodejs/node-gyp#installation

它在文档中清楚地提到如下:https: //github.com/nodejs/node-gyp#installation

Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

选项 1:使用来自提升的 PowerShell 或 CMD.exe(以管理员身份运行)的 npm install --global --production windows-build-tools 使用 Microsoft 的 windows-build-tools 安装所有必需的工具和配置。

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

回答by B T

Look at the installation instructions for node-gyp- you can't just npm install node-gyp. I see you've installed Visual C++, but there's more to it.

查看node-gyp的安装说明- 你不能只是npm install node-gyp. 我看到您已经安装了 Visual C++,但还有更多功能。

What version of windows do you have? If I knew that I might be able to tell you which part of the node-gyp instructions you didn't do, but check them out and you should be able to figure it out. I've gone through a bit of pain for this stuff too.

你有什么版本的windows?如果我知道我可能会告诉你 node-gyp 指令的哪一部分你没有做,但检查它们,你应该能够弄清楚。我也为这些东西经历了一些痛苦。

回答by Gabe Sidler

I tried the above suggested npm install --global --production windows-build-toolsbut found that the installation was always hanging forever.

我尝试了上述建议,npm install --global --production windows-build-tools但发现安装总是永远挂起。

I managed to fix the problem by installing Node.js 8 instead of Node.js 10.

我通过安装 Node.js 8 而不是 Node.js 10 设法解决了这个问题。

回答by darlo

Just to add to the above answer, anyone finding an issue of the installers taking forever, I found my issue was python, I uninstalled both my versions 3 and versions 2.

只是为了补充上面的答案,任何人发现安装程序永远需要的问题,我发现我的问题是 python,我卸载了我的版本 3 和版本 2。

The re-ran the command in PowerShell terminal as the admin and it installed almost straight away.

以管理员身份在 PowerShell 终端中重新运行命令,它几乎立即安装。

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

回答by Karl Horton

The problems here are to do with the npm node-gyp module

这里的问题与 npm node-gyp 模块有关

I found the solutions offered on the build page for that project effective.

我发现该项目的构建页面上提供的解决方案是有效的。

node-gyp page on github

github 上的 node-gyp 页面

There's a fully automatic way and a manual way.

有全自动方式和手动方式。

回答by user3444748

PLEASE FOLLOW THE FLOW CORRECTLY WINDOWS 10x64

请正确遵循流程 WINDOWS 10x64

  1. Powershell run as administrator
  2. npm install -g node-gyp
  3. npm install --global --production windows-build-tools
  1. Powershell 以管理员身份运行
  2. npm install -g node-gyp
  3. npm install --global --production windows-build-tools

回答by AKID Ahmed

Tried npm install mongoose --msvs_version=2012, if you have multiple Visual installed, it worked for me

试过 npm install mongoose --msvs_version=2012,如果你安装了多个 Visual,它对我有用

回答by o.z

As Matt said (https://stackoverflow.com/a/43323045/2767413) you should install the build-tools for windows. However, I did it via cmd and got an error, although I am the administrator -

正如马特所说(https://stackoverflow.com/a/43323045/2767413)你应该安装windows的构建工具。但是,虽然我是管理员,但我通过 cmd 进行了操作并出现错误 -

Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".

I got the same error via a PowerShell.

我通过 PowerShell 遇到了同样的错误。

For windows 7, the administrative PowerShell can be found under:

对于 Windows 7,可以在以下位置找到管理 PowerShell:

Control Panel -> System and Security -> Administrative Tools -> Windows PowerShell Modules

控制面板 -> 系统和安全 -> 管理工具 -> Windows PowerShell 模块