Windows_NT中的bcrypt模块的node-gyp构build错误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),这是我手中唯一的一个。 我添加了C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages所在的PATHvariablesC:\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并失败。 我有六个.NET框架文件夹在C:\Windows\Microsoft.NET\Framework ,它似乎使用最新的一个:

  • 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重build

 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. 

有什么想法吗?

我遵循节点gyp的Windows安装步骤,并安装Microsoft Visual Studio C ++ 2010 Express解决了这个问题,除了一些警告。 我确实看到了在控制台消息中创build的库。

在这里输入图像描述

构build过程似乎正在寻找由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( 快速版运行良好)
    • 对于64位版本的节点和本地模块,您还需要Windows 7 64位SDK
      • 如果安装失败,请尝试卸载您先安装的任何C ++ 2010 x64&x86可再发行组件。
    • 如果您遇到未安装64位编译器的错误,则可能还需要Windows SDK 7.1的编译器更新
  • Windows 7/8:
    • 用于Windows桌面的Microsoft Visual Studio C ++ 2012/13( Express版本运行正常)

这不仅是bcrypt的要求,而且是所有需要使用node-gyp构build的节点模块。 如果您检查模块的configuration文件,您会看到它的要求,例如,您可以检查以下文件:

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