在安装Drywall时,我有一个Bcrypt的问题

我试图安装干墙: 干墙js我和Bcrypt有问题,即使我遵循下面的所有指令,因为我安装了:

  • 安装最新的2.x Python,下载Python(我下载了2.7.9)
  • 安装Visual Studio 2012/13 Express(或其他)
  • 安装Windows SDK(适用于Windows 7/8)
  • 安装Win64 OpenSSL v1.0.1g,从这里下载(我加载了“Win64 OpenSSL v1.0.2a”最新版)

我使用的是Windows 8 X64,nodejs> 0.12.7,bcrypt:0.8

我该如何解决这个问题? 错误如下:

if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) Génération des projets individuellement dans cette solution. Pour activer la génération en parallèle, ajoutez le commutateur "/m". C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be se t to an invalid version number. [C:\SourceCode\MEAN\eventbook\node_modules\bcrypt\build\bcrypt_lib.vcxproj] blowfish.cc bcrypt.cc bcrypt_node.cc c:\users\naoufal\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory (..\src\bcrypt_node.cc) [C:\SourceCode\MEAN\eventbook\node_modules\ bcrypt\build\bcrypt_lib.vcxproj] ..\src\bcrypt.cc(232): warning C4267: '=' : conversion from 'size_t' to 'unsigned char', possible loss of data [C:\SourceCode\MEAN\eventbook\node_modules\bcrypt\build\bcrypt_lib.vcxproj] gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12) gyp ERR! System Windows_NT 6.3.9600 gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\SourceCode\MEAN\eventbook\node_modules\bcrypt gyp ERR! node -v v0.12.7 gyp ERR! node-gyp -v v2.0.1 gyp ERR! not ok npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! code ELIFECYCLE npm ERR! bcrypt@0.8.4 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@0.8.4 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the bcrypt package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls bcrypt npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! C:\SourceCode\MEAN\eventbook\npm-debug.log 

提前致谢!!!

PS:我已经看到了这个答案,但没有为我工作: 错误编译bcrypt节点js 错误编译bcrypt – node.js

如果您使用的是NodeJS ,则最好使用bcrypt的javascript版本,即bcryptjs

为了切换到bcryptjs呢

 npm i -S bcryptjs 

然后在schema / user.js (两次)中使用它来代替bcrypt,

更换

 var bcrypt = require('bcrypt'); 

 var bcrypt = require('bcryptjs'); 

它推翻了工作。 还有一个关于drywall https://github.com/jedireza/drywall/wiki的文档,我认为它也在那里提到。

Interesting Posts