2016-03-06 92 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應該沒有錯誤地構建。

相關問題