node.js - Node bcrypt 安装出现问题

标签 node.js npm sails.js bcrypt

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

npm install bcrypt是我用来安装bcrypt模块的命令,我发现它有很多依赖项,我还安装了node-gypnpm install -g node-埃及人

谁能建议我如何解决这个问题?

错误:

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\Framework\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! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2042435259505460100e170e17" rel="noreferrer noopener nofollow">[email protected]</a> install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="debcbdaca7aeaa9eeef0e9f0e9" rel="noreferrer noopener nofollow">[email protected]</a> 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

最佳答案

我在 Ubuntu 13.10 上遇到了几乎相同的问题,错误日志看起来相同,并且 bcrypt 安装在 node-gyp重建 处停止。经过一些搜索和更新 Node 和 npm 我仍然遇到同样的问题。

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

关于node.js - Node bcrypt 安装出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22853132/

相关文章:

javascript - 如何访问另一个嵌套回调函数内的回调变量?

javascript - Sails.js/Waterline 填充深层嵌套关联

node.js - TypeError : jsdom. createVirtualConsole 不是函数

windows - NPM 已停止在 Windows 7 64 位上工作,在安装/更新时挂起

javascript - https Nginx NodeJS SocketIO 和 CORS 请求失败

node.js - 'npm start' 返回错误 : "There might be a problem with the project dependency tree"

cordova - 在 NPM 中获取包的早期版本

sails.js - 我们可以在sails js Collection中使用嵌套的where子句吗

angularjs - setTimeout NodeJS性能

node.js - 用于选择性推送的通知系统的 Redis pub/sub 模型