【问题标题】:Trouble with node bcrypt installation节点 bcrypt 安装问题
【发布时间】:2014-04-04 03:45:59
【问题描述】:

我正在学习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\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! 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

【问题讨论】:

  • 您能否描述、复制/粘贴您尝试安装bcrypt 时出现的错误?
  • 更新我的问题@Phoenix
  • 看来它无法找到 opessl 标头,因为您在 Windows 机器上,请查看 C:\Users\Aditya Sethi\.node-gyp\0.10.22\deps 应该有一个 opessl 文件夹,其中包含 openssl 标头如果未指定 @ 987654328@ 参数从.node-gyp 目录下的先前节点源加载,例如npm install bcrypt -V --node-dir='C:\Users\Aditya Sethi\.node-gyp\0.10.3'

标签: node.js npm sails.js bcrypt


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

    npm install --global --production windows-build-tools

    【讨论】:

      猜你喜欢
      • 2015-02-24
      • 2021-06-29
      • 1970-01-01
      • 1970-01-01
      • 2019-04-22
      • 1970-01-01
      • 2020-03-22
      • 2015-04-30
      • 1970-01-01
      相关资源
      最近更新 更多