问题描述
在我的 Windows 机器上安装 bcrypt 时出现此错误,我正在使用
While installing bcrypt I'm getting this error in my windows machine, I'm using
- 节点 v8.9.4
- npm v5.6.0
- bcrypt v1.0.3
C:UsersuserDesktopmysql_node_apiegister_loginegister_login>npm安装 bcrypt --save > [email protected] 安装C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulescrypt > node-pre-gyp install--fallback-to-build node-pre-gyp ERR!尝试下载(未定义):https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v57-win32-x64.tar.gz节点预gyp错误!未找到 [email protected] 和 [email protected] ( node-v57 ABI) 的预构建二进制文件(回退到源代码编译节点gyp)gyp错误!配置错误gyp ERR!堆栈错误:找不到Python 可执行文件python",可以设置 PYT HON环境变量.吉普错误!堆栈在 PythonFinder.failNoPython (C:UsersuserAppDataRoamingpmode_modulespmode_modulesode-gyplibconfigure.js:483:19) gyp呃!PythonFinder 的堆栈.(C:UsersuserAppDataRoamingp mode_modulespmode_modulesode-gyplibconfigure.js:508:16) gyp呃!堆栈在C:UsersuserAppDataRoamingpmode_modulespmode_modulesgraceful-fspolyfills.js:284:29 gyp 错误!堆栈在FSReqWrap.oncomplete(fs.js:152:21) gyp 错误!系统 Windows_NT 6.1.7601 gyp 错误!命令C:Program Filesodejsode.exe""C:UsersuserAppData漫游pmode_modulespmode_modulesode-gypinode-gyp.js"配置" --fallback-to-build""--module=C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulescryptlibindingcrypt_lib.node" "--module_name=bcrypt_lib""--module_path=C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulescryptlibinding"吉普错误!cwd C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulescrypt gyp 错误!节点 -v v8.9.4 gyp 错误!节点gyp -vv3.6.2 gyp 错误!不好节点预gyp ERR!构建错误节点-pre-gyp ERR!堆栈错误:无法执行 'C:ProgramFilesodejsode.exe C:UsersuserAppDataRoamingpmode_modulespmode_modulesode-gypinode-gyp.js 配置 --fallback-to-build--module=C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulescryptlibindingcrypt_lib.node --module_name=bcrypt_lib --module_path=C:UsersuserDesktopmysql_node_ap iegister_loginegister_loginode_modulescryptlibinding' (1)节点预gyp错误!ChildProcess 的堆栈.(C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulesode-pre-gyplibutilcompile.js:83:29)节点预gyp错误!堆栈在 emitTwo (events.js:126:13)节点预gyp错误!ChildProcess.emit (events.js:214:7) 的堆栈节点预gyp呃!堆栈在可能关闭(内部/child_process.js:925:16)节点预gyp错误!Process.ChildProcess._handle.onexit 处的堆栈(internal/chi ld_process.js:209:5) node-pre-gyp ERR!系统视窗_NT6.1.7601 节点预gyp ERR!命令C:Program Filesodejsode.exe""C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulesode-pre-gypinode-pre-gyp" "安装" "--fallback-to-build" node-pre-gyp呃!cwd C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulescrypt节点预gyp错误!node -v v8.9.4 node-pre-gyp 错误!node-pre-gyp -v v0.6.36 node-pre-gyp ERR!不行 执行失败'C:Program Filesodejsode.exe C:UsersuserAppDataRoamingpmode_modulespmode_modulesode-gypinode-gyp.js 配置--fallback k-to-build --module=C:UsersuserDesktopmysql_node_apiegister_loginegister _loginode_modulescryptlibindingcrypt_lib.node --module_name=bcrypt_lib --module_path=C:UsersuserDesktopmysql_node_apiegister_loginegister_loginode_modulescryptlibinding' (1) npm 错误!代码 ELIFECYCLE npm 错误!errno 1 npm 错误![email protected] 安装:node-pre-gyp 安装--fallback-to-build npm 错误!退出状态 1 npm ERR!npm 错误![email protected] 安装脚本失败.npm 错误!
这可能不是 npm 的问题.上面可能有额外的日志输出.npm 错误!本次运行的完整日志可以在:npm ERR!C:UsersuserAppDataRoamingpm-cache_logs2018-02-25T14_42_29_529Z-debug.log
This is probably not a problem with npm. There is likely additional log ging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:UsersuserAppDataRoamingpm-cache_logs2018-02-25T14_42_29_5 29Z-debug.log
推荐答案
我在使用 node v14.x 时也遇到了这个错误.我发现 bcrypt v1.0.3 的预构建二进制文件不适用于节点 v14.要修复它,我必须安装不同的 bcrypt 版本.
I also encountered this error im using node v14.x. I found out that the pre-built binaries of bcrypt v1.0.3 is not available for node v14. To fix it, I have to install a different bcrypt version.
npm uninstall bcrypt --save
npm install bcrypt@5 --save
就是这样.现在可以了!
That's it. It works now!
这篇关于[email protected] 安装:`node-pre-gyp install --fallback-to-build`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!