2016-03-06 123 views
1

我试过了一切,我安装了正确版本的Python(Python27),安装了Windows SDK 8.1,但Visual C++也安装了,但构建仍然失败。我正在使用Visual Studio 2015社区编辑器。当我尝试从CMD我碰到下面的错误执行node-gyp build在Visual Studio 2015中构建node-gyp项目时出现LNK1104错误

> C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.t 
argets(44,5): error MSB8020: The builds tools for v140 (Platform Toolset = 'v14 
0') cannot be found. To build using the v140 build tools, either click the Proj 
ect menu or right-click the solution, and then select "Update VC++ Projects..." 
. Install v140 to build using the v140 build tools. [C:\Users\Programming PC\Do 
cuments\GitHub\node-addon-examples\1_hello_world\node_0.10\build\hello.vcxproj] 

此错误促使我进入到Visual Studio,看看该项目至少可以建立并从那里运行,它没有。

请帮我看看所有与这个问题有关的其他问题,但他们的解决方案都没有帮助我。

enter image description here

+0

您是否尝试明确设置'msvs_version'如:'node-gyp rebuild --msvs_version = 2015'? – mscdex

+0

是msvs_version = 2015甚至在我的.npmrc中硬编码 – lavacode

+0

您安装的Visual C++的版本究竟是什么? Visual Studio社区? Visual Studio Express for Windows? Visual Studio Express for Desktop? (小贴士:我一直使用Express for Desktop,并且没有问题) – mscdex

回答

1

花了很多的研究,但我找到了解决方案(S)。首先,要摆脱MSB8020错误,请添加VisualStudioVersion环境变量并将其设置为您的Visual Studio版本,或者执行node-gyp build并使用此标志/p:VisualStudioVersion=14.0(在我的情况下)。

我解决了这个问题后,我确实得到了不同的错误,我相信他们是值得一提的。

错误MSB4175再出现了,基本上表明它无法找到Microsoft.Build.Tasks.v12.0.dll(请在此.dll文件进行搜索,找出它通常位于),复制并粘贴到它在寻找它的路径。

现在这里是kicker,中断node-gyp的最后一个错误是因为缺少.lib文件。 Npm不会创建以下文件...\.node-gyp\4.3.1\Debug\node.lib。所以你需要去here并下载一个node.lib和mkdir Debug \,并把node.lib放在那里。

之后node-gyp应该没有错误地构建。

相关问题