You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用electron-builder构建应用时,如何跳过签名操作?

如何完全跳过electron-builder的签名步骤?

我的electron-builder配置

{
  "$schema": "node_modules/app-builder-lib/scheme.json",
  "asar": true,
  "directories": {
    "output": "release/${version}"
  },
  "electronDist": "./node_modules/electron/dist",
  "files": ["dist-electron", ".output/**/*", "!node_modules/**/*"],
  "electronLanguages": ["zh-CN"],
  "win": {
    "icon": ".output/public/favicon.ico",
  },
  "npmRebuild": false,
  "nsis": {
    "oneClick": false,
    "perMachine": false,
    "allowToChangeInstallationDirectory": true,
    "deleteAppDataOnUninstall": true
  }
}

初始构建输出

• electron-builder  version=25.1.8 os=10.0.22631
• loaded configuration  file=D:\Solutions\rho-meter\electron-builder.json
• writing effective config  file=release\0.0.1\builder-effective-config.yaml
• skipped dependencies rebuild  reason=npmRebuild is set to false
• packaging       platform=win32 arch=x64 electron=33.3.1 appOutDir=release\0.0.1\win-unpacked
• copying Electron  source=D:\Solutions\rho-meter\node_modules\electron\dist destination=D:\Solutions\rho-meter\release\0.0.1\win-unpacked
• updating asar integrity executable resource  executablePath=release\0.0.1\win-unpacked\rho-meter.exe
• signing with signtool.exe  path=release\0.0.1\win-unpacked\rho-meter.exe
• no signing info identified, signing is skipped  signHook=false cscInfo=null
• building        target=nsis file=release\0.0.1\rho-meter Setup 0.0.1.exe archs=x64 oneClick=false perMachine=false
• signing with signtool.exe  path=release\0.0.1\win-unpacked\resources\elevate.exe
• no signing info identified, signing is skipped  signHook=false cscInfo=null
• signing with signtool.exe  path=release\0.0.1\__uninstaller-nsis-rho-meter.exe
• no signing info identified, signing is skipped  signHook=false cscInfo=null
• signing with signtool.exe  path=release\0.0.1\rho-meter Setup 0.0.1.exe
• no signing info identified, signing is skipped  signHook=false cscInfo=null
• building block map  blockMapFile=release\0.0.1\rho-meter Setup 0.0.1.exe.blockmap

添加signAndEditExecutable: false后的输出

• electron-builder  version=25.1.8 os=10.0.22631
• loaded configuration  file=D:\Solutions\rho-meter\electron-builder.json
• writing effective config  file=release\0.0.1\builder-effective-config.yaml
• skipped dependencies rebuild  reason=npmRebuild is set to false
• packaging       platform=win32 arch=x64 electron=33.3.1 appOutDir=release\0.0.1\win-unpacked
• copying Electron  source=D:\Solutions\rho-meter\node_modules\electron\dist destination=D:\Solutions\rho-meter\release\0.0.1\win-unpacked
• updating asar integrity executable resource  executablePath=release\0.0.1\win-unpacked\rho-meter.exe
• building        target=nsis file=release\0.0.1\rho-meter Setup 0.0.1.exe archs=x64 oneClick=false perMachine=false
• signing with signtool.exe  path=release\0.0.1\__uninstaller-nsis-rho-meter.exe
• no signing info identified, signing is skipped  signHook=false cscInfo=null
• signing with signtool.exe  path=release\0.0.1\rho-meter Setup 0.0.1.exe
• no signing info identified, signing is skipped  signHook=false cscInfo=null
• building block map  blockMapFile=release\0.0.1\rho-meter Setup 0.0.1.exe.blockmap

解决方法

要完全跳过所有签名尝试,需要同时配置两个关键项:

  1. 在win配置中添加"sign": false,关闭Windows主程序的签名检查
  2. 在nsis配置中添加"sign": false,关闭NSIS安装包及卸载程序的签名尝试

修改后的完整配置如下:

{
  "$schema": "node_modules/app-builder-lib/scheme.json",
  "asar": true,
  "directories": {
    "output": "release/${version}"
  },
  "electronDist": "./node_modules/electron/dist",
  "files": ["dist-electron", ".output/**/*", "!node_modules/**/*"],
  "electronLanguages": ["zh-CN"],
  "win": {
    "icon": ".output/public/favicon.ico",
    "sign": false
  },
  "npmRebuild": false,
  "nsis": {
    "oneClick": false,
    "perMachine": false,
    "allowToChangeInstallationDirectory": true,
    "deleteAppDataOnUninstall": true,
    "sign": false
  }
}

说明

  • signAndEditExecutable仅控制Electron主程序的签名编辑步骤,无法覆盖NSIS相关组件的签名逻辑
  • 同时设置win.sign和nsis.sign为false后,electron-builder会完全跳过所有签名尝试,不会再输出签名相关日志

内容的提问来源于stack exchange,提问作者Yue JIN

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 23:37:06