在 Electron 构建期间创建符号链接时出错

问题描述 投票:0回答:1

尝试使用 Electron Builder 构建我的 Electron 应用程序失败,并出现与符号链接相关的错误:

Scanning the drive for archives:
    1 file, 5635384 bytes (5504 KiB)

    Extracting archive: C:\Users\Lenovo\AppData\Local\electron-builder\Cache\winCodeSign\496893375.7z
    --
    Path = C:\Users\Lenovo\AppData\Local\electron-builder\Cache\winCodeSign\496893375.7z
    Type = 7z
    Physical Size = 5635384
    Headers Size = 1492
    Method = LZMA2:24m LZMA:20 BCJ2
    Solid = +
    Blocks = 2

    Sub items Errors: 2

    Archives with Errors: 1

    Sub items Errors: 2

    errorOut=ERROR: Cannot create symbolic link : A required privilege is not held by the client. : C:\Users\Lenovo\AppData\Local\electron-builder\Cache\winCodeSign\496893375\darwin\10.12\lib\libcrypto.dylib
    ERROR: Cannot create symbolic link : A required privilege is not held by the client. : C:\Users\Lenovo\AppData\Local\electron-builder\Cache\winCodeSign\496893375\darwin\10.12\lib\libssl.dylib

    command='C:\techstone\electronjs\parts-app\node_modules\7zip-bin\win\x64\7za.exe' x -bd 'C:\Users\Lenovo\AppData\Local\electron-builder\Cache\winCodeSign\496893375.7z' '-oC:\Users\Lenovo\AppData\Local\electron-builder\Cache\winCodeSign\496893375'
    workingDir=C:\Users\Lenovo\AppData\Local\electron-builder\Cache\winCodeSign
  • Above command failed, retrying 0 more times

项目信息:

  • 电子:^31.3.0
  • 电子制造商:^24.13.3
  • 操作系统:Windows 10(也在 Windows 11 上进行测试)
  • Node.js 版本:16.x

package.json:

{
  "name": "parts-app",
  "version": "0.1.0",
  "private": true,
  "main": "main/electron.js",
  "homepage": ".",
  "dependencies": { ... },
  "scripts": {
    "start": "concurrently \"npm run start-react\" \"npm run start-electron\"",
    "build": "react-scripts build && electron-builder",
    "postinstall": "electron-builder install-app-deps",
  },
  "build": {
    "appId": "com.parts-app",
    "directories": {
      "output": "dist"
    },
    "win": {
      "target": [
        "nsis",
        "portable"
      ]
    }
  }
}

文章建议在 Windows 上启用开发人员模式来绕过符号链接权限问题。然而,我的目标是对应用程序进行代码签名,我不确定启用开发人员模式有何帮助。使用管理员权限运行构建,问题仍然存在。

为什么在 Windows 构建过程中处理 macOS 特定的文件(libcrypto.dylib 和 libssl.dylib)?正确的代码签名需要采取哪些步骤?如何防止在 Windows 构建过程中处理这些 macOS 相关文件?是否有更好的方法来解决符号链接错误,特别是对于 Windows 版本?

windows electron code-signing electron-builder
1个回答
0
投票

检查此链接以获取任何解决方法:https://github.com/electron-userland/electron-builder/issues/8149

提出此 PR 是为了解决问题 https://github.com/electron-userland/electron-builder/pull/8530 但尚未合并。

© www.soinside.com 2019 - 2024. All rights reserved.