简体   繁体   English

无法安装模块node.js

[英]Can't install module node.js

I'm trying to install a module from npm to use in my project. 我正在尝试从npm安装模块以在我的项目中使用。 Altough, everytime I try, I get this message: 每次尝试时,都会收到以下消息:

MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe".
 If the component is not installed, either 1) install the Microsoft Windows SDK
 for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual
 Studio 2008.  [C:\Users\<name>\Desktop\max-node\control\node_modules\xbox-cont
roller\node_modules\node-hid\build\binding.sln]

I've tried downloading the .NET framework and installing it several times and nothing happens, I've already got the SDK installed. 我尝试下载.NET框架并将其安装几次,但没有任何反应,我已经安装了SDK。

How do I fix it? 我如何解决它?

Thanks 谢谢

- Mackan -麦肯

The module you're trying to install (node-hid) uses a binary library requiring compilation for your architecture. 您要安装的模块(node-hid)使用一个二进制库,需要对该体系结构进行编译。 From the error message, it appears that MSBUILD cannot locate VCBuild.exe which is probably caused by a missing directory in your PATH environment variable. 从错误消息来看,似乎MSBUILD无法找到VCBuild.exe,这可能是由于PATH环境变量中缺少目录所致。 To set things up correctly, you'll need to 要正确设置,您需要

  1. add the location of VCBuild.exe to your PATH environment variable. 将VCBuild.exe的位置添加到PATH环境变量中。
  2. npm install -g node-gyp npm install -g node-gyp

This will reinstall the node-gyp native extension compiler which, once you add the location of VCBuild.exe to your path, should be able to install any npm module. 这将重新安装node-gyp本机扩展编译器,一旦将VCBuild.exe的位置添加到路径中,该编译器便应能够安装任何npm模块。

See node-gyp for more information. 有关更多信息,请参见node-gyp

Also see error MSB3411: Could not l oad the Visual C++ component "VCBuild.exe" 另请参见错误MSB3411:无法加载Visual C ++组件“ VCBuild.exe”

Download Visual Studio Express from here , then simply run the following command: 此处下载Visual Studio Express,然后只需运行以下命令:

npm config --global set msvs_version 2015 (assuming you've download VSE 2015) npm config --global set msvs_version 2015 (假设您已下载VSE 2015)

If you have any further issues, make sure your PATH environment variable includes the location of VCBuild.exe (as described in the previous answer). 如果还有其他问题,请确保PATH环境变量包含VCBuild.exe的位置(如上一个答案中所述)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM