Bcrypt 3.0.1无法在节点v 8.12.0上安装

时间:2018-10-10 01:19:19

标签: node.js angular bcrypt

Bcrypt 3.0.1无法在节点v 8.12.0上安装

npm调试日志:

1224 verbose stack Error: bcrypt@3.0.0 install: `node-pre-gyp install --fallback-to-build`
1224 verbose stack Exit status 1
1224 verbose stack     at EventEmitter.<anonymous> (d:\brd\app\node-v8.12.0-win-x64\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
1224 verbose stack     at emitTwo (events.js:126:13)
1224 verbose stack     at EventEmitter.emit (events.js:214:7)
1224 verbose stack     at ChildProcess.<anonymous> (d:\brd\app\node-v8.12.0-win-x64\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
1224 verbose stack     at emitTwo (events.js:126:13)
1224 verbose stack     at ChildProcess.emit (events.js:214:7)
1224 verbose stack     at maybeClose (internal/child_process.js:915:16)
1224 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
1225 verbose pkgid bcrypt@3.0.0
1226 verbose cwd d:\brd\proj\2018\projects\projectname
1227 verbose Windows_NT 6.1.7601
1228 verbose argv "d:\\brd\\app\\node-v8.12.0-win-x64\\node.exe" "d:\\brd\\app\\node-v8.12.0-win-x64\\node_modules\\npm\\bin\\npm-cli.js" "i" "bcrypt@3.0.0" "--save"
1229 verbose node v8.12.0
1230 verbose npm  v6.4.1
1231 error code ELIFECYCLE
1232 error errno 1
1233 error bcrypt@3.0.0 install: `node-pre-gyp install --fallback-to-build`
1233 error Exit status 1
1234 error Failed at the bcrypt@3.0.0 install script.
1234 error This is probably not a problem with npm. There is likely additional logging output above.

https://www.youtube.com/3mhealthcare所述,此PR(here)似乎已解决此问题,但该补丁尚未在npm存储库中发布。

知道如何解决此问题吗?

2 个答案:

答案 0 :(得分:1)

解决方案是安装构建工具,以便angular可以自己创建bcrypt。

在Windows上完成了这项工作:

npm --add-python-to-path='true' --debug install --global windows-build-tools

答案 1 :(得分:0)

替代方法是使用bcryptjs。

npm install bcryptjs --save