节点bcrypt安装有问题

时间:2014-04-04 03:45:59

标签: node.js npm sails.js bcrypt

我正在学习sails.js。所以我只想用节点模块bcrypt来加密密码。

npm install bcrypt是我用来安装bcrypt模块的命令,我发现它有很多依赖项,我也使用了node-gyp npm install -g node-gyp

任何人都可以建议我如何解决它?

错误:

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. blowfish.cc bcrypt.cc bcrypt_node.cc C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specif y /EHsc [c:\Users\Aditya Sethi\Documents\backup\My-Twitter\node_modules\bcrypt\ build\bcrypt_lib.vcxproj] ..\src\bcrypt_node.cc(38): fatal error C1083: Cannot open include file: 'openss l/rand.h': No such file or directory [c:\Users\Aditya Sethi\Documents\backup\My -Twitter\node_modules\bcrypt\build\bcrypt_lib.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\的Windows \ Microsoft.NET \框架\ v4.0.30319 \ 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:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789: 12) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "node" "c:\\Program Files\\nodejs\\node_modules\\npm\\node_modu les\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd c:\Users\Aditya Sethi\Documents\backup\My-Twitter\node_modules\bcry pt gyp ERR! node -v v0.10.22 gyp ERR! node-gyp -v v0.11.0 gyp ERR! not ok npm ERR! bcrypt@0.7.7 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@0.7.7 install script. 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! System Windows_NT 6.1.7601 npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej s\\node_modules\\npm\\bin\\npm-cli.js" "install" "bcrypt" "--save" npm ERR! cwd c:\Users\Aditya Sethi\Documents\backup\My-Twitter npm ERR! node -v v0.10.22 npm ERR! npm -v 1.3.14 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! c:\Users\Aditya Sethi\Documents\backup\My-Twitter\npm-debug.log npm ERR! not ok code 0

3 个答案:

答案 0 :(得分:5)

我在Ubuntu 13.10上遇到了同样的问题,错误日志看起来一样,bcrypt安装在node-gyp rebuild停止了。经过一些搜索和更新节点和npm之后,我仍然遇到了同样的问题。

我终于在这里找到了一个解决方案:https://github.com/ncb000gt/node.bcrypt.js/issues/90问题是~/.node-gyp目录,它具有不足的访问权限,只是删除它就可以了。这是gyp在编译期间存储头文件和其他构建文件的地方,如果它已经消失,gyp将只重新创建它。

答案 1 :(得分:0)

如果您使用的是Windows,请尝试安装全局Windows构建工具, 跟随此链接bcrypt install instruction

  

npm install --global --production Windows-build-tools

答案 2 :(得分:0)

我已经通过运行命令npm clean-install进行了修复。我正在使用8.12.0的节点版本。