安装Drywall时我遇到了Bcrypt问题

时间:2015-08-03 15:01:17

标签: node.js npm windows-8.1 bcrypt drywall

我正在尝试安装Drywall:Drywall 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:我已经看过这个答案,但对我不起作用:error compiling bcrypt node js Error compiling bcrypt - node.js

1 个答案:

答案 0 :(得分:0)

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

要切换到bcryptjs,请执行

npm i -S bcryptjs

然后在架构/ user.js (两次)中需要它而不是bcrypt

替换

var bcrypt = require('bcrypt');

var bcrypt = require('bcryptjs');

它的工作原理。 还有关于干墙的文件 https://github.com/jedireza/drywall/wiki 我认为它也在某处提到过。