簡體   English   中英

Windows_NT 6.1.7600(x86)中bcrypt模塊的node-gyp構建錯誤

[英]node-gyp build error for bcrypt module in Windows_NT 6.1.7600 (x86)

我找到了許多答案,就像這個問題,但所有這些都無法解決我的問題。 這是我安裝的版本:

node 0.10.31
npm 1.4.23
node-gyp 0.10.31
bcrypt 0.7.8 

我在package.json "bcrypt": "0.7.x"有依賴"bcrypt": "0.7.x" 這是我的一步一步:

1)運行npm install

gyp ERR! stack Error: Can't find Python executable "python", you can
set the PYTHON env variable.

我不得不安裝Python 2.7。*

2)運行npm install

MSBUILD : error MSB3428: Could not load the Visual C++ component
"VCBuild.exe". To fix this,  1) install the .NET Framework 2.0 SDK, 
2) install Microsoft Visual Studio 2005 or 3) add the location of the
component to the system path if it is installed elsewhere.  

我不得不安裝Visual Studio 2008(Professional),這是我手中唯一的。 我在vcbuild.exe中添加了PATH變量C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\vcpackages

3)再次運行npm install

VCBUILD : error Message: [D:\...\node_modules\bcrypt\build\binding.sln]  
VCBUILD : System error : -2147154687. [D:\...\node_modules\bcrypt\build\binding.sln]  
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` 
failed with exit code: 1  

它似乎使用.NET 4而失敗了。 我在C:\\Windows\\Microsoft.NET\\Framework有六個.NET框架文件夾,它似乎使用了最新的一個:

  • 1.0.3705
  • V1.1.4322
  • V2.0.50727
  • V3.0
  • V3.5
  • v4.0.30319

4)嘗試了npm install --msvs_version=2008

(2)相同的錯誤。

5)嘗試npm install --msvs_version=2012

錯誤改變了一點。

D:\...\node_modules\bcrypt\build\bcrypt_lib.vcxproj(18,3): error MSB4019: The imported 
project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the 
<Import> declaration is correct, and that the file exists on disk.  
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` 
failed with exit code: 1

6)嘗試node-gyp重建

D:\...\node-proj>node-gyp rebuild --msvs_version=2008
'node-gyp' is not recognized as an internal or external command, 
operable program or batch file.

對此有什么想法嗎?

我按照node-gyp的Windows安裝步驟進行操作 ,安裝Microsoft Visual Studio C ++ 2010 Express解決了這個問題,除了一些警告。 我確實看到了在控制台消息中創建的庫。

在此輸入圖像描述

構建過程似乎正在尋找由Visual Studio C ++ 2010 Express安裝的[Drive]:\\Program Files\\Microsoft Visual Studio 10.0\\VC\\vcpackages\\vcbuild.dll

首先,我為Windows桌面安裝了Microsoft Visual Studio C ++ 2012/13 ,這是Windows7 / 8的要求之一。 但它實際上並不起作用,對於Windows 7來說並不是必需的

結論

Windows 7 32位node-gyp要求(Windows 7/8 64位可能有不同的要求):

  • Python v2.7.3 (不支持v3.xx)
  • Windows XP / Vista / 7:
    • Microsoft Visual Studio C ++ 2010( Express版本運行良好)
    • 對於64位版本的節點和本機模塊,您還需要Windows 7 64位SDK
      • 如果安裝失敗,請嘗試卸載先安裝的任何C ++ 2010 x64和x86 Redistributable。
    • 如果您收到未安裝64位編譯器的錯誤,則可能還需要Windows SDK 7.1編譯器更新
  • Windows 7/8:
    • 用於Windows桌面的Microsoft Visual Studio C ++ 2012/13( Express版本運行良好)

這不僅是bcrypt的要求,也是需要使用node-gyp構建的所有節點模塊的要求。 如果檢查模塊的配置文件,您將看到其要求,例如,您可以檢查以下文件:

  • \\node_modules\\bcrypt\\build\\binding.sln
  • \\node_modules\\bcrypt\\build\\config.gypi

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM