【发布时间】:2015-01-18 00:27:07
【问题描述】:
我找到了很多类似这个问题的答案,但他们都无法解决我的问题。这是我安装的版本:
node 0.10.31
npm 1.4.23
node-gyp 0.10.31
bcrypt 0.7.8
我在 package.json "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(专业版),这是我手中唯一的一个。我在 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 框架文件夹,似乎使用的是最新的:
- v1.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.js windows-7 node-gyp