【问题标题】:npm install, node-gyp rebuild errornpm 安装,node-gyp 重建错误
【发布时间】:2023-03-17 11:01:01
【问题描述】:

我刚开始使用 node.js,当我尝试 npm install 时,我收到一条错误消息,指出 Failed at the bcrypt@0.8.5 install script 'node-gyp rebuild'。经过广泛的谷歌搜索,我仍然没有发现问题。

这是错误日志:

Error Log

313 verbose stack Error: bcrypt@0.8.5 install: `node-gyp rebuild`
313 verbose stack Exit status 1
313 verbose stack     at EventEmitter.<anonymous> (C:\Users\Apparaat1\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:239:16)
313 verbose stack     at emitTwo (events.js:100:13)
313 verbose stack     at EventEmitter.emit (events.js:185:7)
313 verbose stack     at ChildProcess.<anonymous> (C:\Users\Apparaat1\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:24:14)
313 verbose stack     at emitTwo (events.js:100:13)
313 verbose stack     at ChildProcess.emit (events.js:185:7)
313 verbose stack     at maybeClose (internal/child_process.js:827:16)
313 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
314 verbose pkgid bcrypt@0.8.5
315 verbose cwd D:\Werk\W12C\we12c\W12C
316 error Windows_NT 6.1.7601
317 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Apparaat1\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
318 error node v5.7.0
319 error npm  v3.7.3
320 error code ELIFECYCLE
321 error bcrypt@0.8.5 install: `node-gyp rebuild`
321 error Exit status 1
322 error Failed at the bcrypt@0.8.5 install script 'node-gyp rebuild'.
322 error Make sure you have the latest version of node.js and npm     installed.
322 error If you do, this is most likely a problem with the bcrypt package,
322 error not with npm itself.
322 error Tell the author that this fails on your system:
322 error     node-gyp rebuild
322 error You can get information on how to open an issue for this project     with:
322 error     npm bugs bcrypt
322 error Or if that isn't available, you can get their info via:
322 error     npm owner ls bcrypt
322 error There is likely additional logging output above.
323 verbose exit [ 1, true ]

版本: 节点-v v5.7.0 npm -v 3.7.3

【问题讨论】:

  • 尝试安装node v 0.12.5
  • @WasiqMuhammad 回击:错误在 fsevents@1.0.7 安装脚本“node-pre-gyp install --fallback-to-build”处失败。

标签: node.js npm node-gyp rebuild


【解决方案1】:

可能有点晚了,但是 node-gyp 中的解决方案 https://github.com/nodejs/node-gyp#installation 有2个 不同的选择。

  1. 选项 1:通过提升的 PowerShell 或 CMD.exe(以管理员身份运行)使用 Microsoft 的 windows-build-tools 使用 npm install --global --production windows-build-tools 安装所有必需的工具和配置。

  2. 选项 2:手动安装工具和配置:

    • Visual C++ 构建环境:

      • 选项 1:使用 默认安装 选项安装 Visual C++ Build Tools

      • 选项 2:安装 Visual Studio 2015(或修改现有安装)并在安装过程中选择 Common Tools for Visual C++。这也适用于免费的 Community 和 Express for Desktop 版本。

    • 安装Python 2.7(不支持v3.x.x)并运行npm config set python python2.7(或参见下文了解有关指定正确Python版本和路径的进一步说明。)

    • 启动cmd,npm config set msvs_version 2015

    如果上述步骤对您不起作用,请访问 Microsoft's Node.js Guidelines for Windows 获取更多提示。

[仅限 Windows Vista / 7] 需要 .NET Framework 4.5.1

【讨论】:

    猜你喜欢
    • 2015-12-07
    • 2015-12-23
    • 1970-01-01
    • 2019-06-11
    • 2019-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-21
    相关资源
    最近更新 更多