简体   繁体   English

如何在Windows 10上解决'node-gyp rebuild'问题?

[英]How to solve 'node-gyp rebuild' issue on Windows 10?

As part of trying to use a node NPM dependency in a project, I get a node-gyp rebuild issue, which I have reported . 作为尝试在项目中使用节点NPM依赖项的一部分,我得到了一个node-gyp rebuild问题,我已经报告过了

I am aware of the solution in this SO question , but it does not work for Windows 10 (I am on 32 bits, I don't know whether this is relevant). 我知道这个SO问题的解决方案,但它不适用于Windows 10(我是32位,我不知道这是否相关)。 Windows SDK 7.1 (and others) won't install. Windows SDK 7.1(和其他)将无法安装。

Does anyone have an operational solution for Windows 10? 有没有人有Windows 10的运营解决方案?

Udpate UDPATE

After trying npm install <module name> --msvs_version=2013 , I get a new error message: 在尝试npm install <module name> --msvs_version=2013 ,我收到一条新的错误消息:

在此输入图像描述

I solved this problem on windows 8 and windows 10 pro with this tutorial . 我在本教程的 Windows 8和Windows 10专业版上解决了这个问题。 I try a lot of times to solve this problem with many different solutions, but only worked for me this 我尝试了很多次用许多不同的解决方案来解决这个问题,但这只对我有用
I notice that i didn't use nodist to control the node version like this tutorial, I use NVM and worked fine, i don't test this tutorial with nodist. 我注意到我没有像本教程一样使用nodist来控制节点版本,我使用NVM并且工作正常,我不用nodist测试本教程。 I used node 5.2.0. 我使用了节点5.2.0。

Edit: 编辑:

Following the suggested by @prasun, the steps in correct order: 按照@prasun的建议,正确顺序的步骤:

  • Download and install Git SCM from HERE 这里下载并安装Git SCM
  • Download Visual Studio Community HERE and install a Custom Installation, selecting ONLY the following packages: VISUAL C++ , PYTHON TOOLS FOR VISUAL STUDIO and MICROSOFT WEB DEVELOPER TOOLS 这里下载Visual Studio社区并安装自定义安装, 选择以下软件包: VISUAL C ++用于可视工作室的PYTHON工具MICROSOFT WEB开发工具
  • Download and install Python 2.7.x from HERE HERE下载并安装Python 2.7.x.
  • Register a Environment Variable with name: GYP_MSVS_VERSION with this value: 2015. 使用以下值注册名称为GYP_MSVS_VERSION的环境变量:2015。

This is the only steps work for me in windows 8.1 and windows 10. 这是Windows 8.1和Windows 10中唯一适合我的步骤。

To install node addons, you need to have VC/VCExpress installed and not just the VC runtime/redistributable. 要安装节点插件,您需要安装VC / VCExpress,而不仅仅是VC运行时/可再发行组件。 Make sure it's the "Windows Desktop" edition. 确保它是“Windows桌面”版本。

After that, you should be able to install addons via npm (you may have to re-open any command prompts you had open before installing VCExpress though). 之后,您应该能够通过npm安装插件(在安装VCExpress之前,您可能必须重新打开已打开的任何命令提示)。

这对我有用:

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

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

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