[email protected] 安装:`node-pre-gyp install --fallback-to-build` bcrypt 3.0.3

[email protected] 安装:`node-pre-gyp install --fallback-to-build` bcrypt 3.0.3

你好,我尝试了所有方法来解决这个问题,但都没有用。我尝试安装 bcrypt,但它丢失了这条消息

[email protected] install: node-pre-gyp install --fallback-to-build

问题日志(完整日志位于https://github.com/kelektiv/node.bcrypt.js/issues/692):

1198 warn [email protected] No repository field. 
1199 verbose stack Error: [email protected] install: `node-pre-gyp install
--fallback-to-build` 
1199 verbose stack Exit status 1 1199 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16) 1199 verbose stack     at EventEmitter.emit (events.js:182:13) 
1199 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 
1199 verbose stack     at ChildProcess.emit (events.js:182:13) 
1199 verbose stack     at maybeClose (internal/child_process.js:962:16) 
1199 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5) 
1200 verbose pkgid [email protected] 
1201 verbose cwd C:\Users\user\Desktop\Programacion\Nodejs\node-rest-shop 
1202 verbose Windows_NT 10.0.17134 
1203 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bcrypt" 
1204 verbose node v10.14.2 
1205 verbose npm  v6.4.1 1206 error code ELIFECYCLE 
1207 error errno 1 
1208 error [email protected] install: `node-pre-gyp install --fallback-to-build` 
1208 error Exit status 1 1209 error Failed at the [email protected] install script. 
1209 error This is probably not a problem with npm. There is likely additional logging output above. 1210 verbose exit [ 1, true ]

软件包.json:

"dependencies": { "bcryptjs": "^2.4.3", "body-parser": "^1.18.3", "express": "^4.16.4", "mongoose": "^5.4.0", "morgan": "^1.9.1", "multer": "^1.4.1", "request": "^2.88.0" },

版本:

npm:6.4.1

节点:v10.14.2

答案1

今天,我在尝试在 Windows 10 桌面上安装 bcrypt 时也遇到了同样的问题。事实证明,bcrypt 支持稳定版本的节点,最好查看文档

对我来说,解决方案是:

  1. 将节点升级到稳定版本:我从 Node 网站手动下载并安装了 Windows 安装程序。
  2. 全局安装 Windows 构建工具:npm install --global --production windows-build-tools
  3. 最后npm install bcrypt --save

此后一切正常。

原答案在这里

相关内容