我正在开发一个 Electron.js 应用程序并尝试使用 electro-builder 来构建它。构建过程失败,并出现以下与符号链接相关的错误:
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 版本?
检查此链接以获取任何解决方法:https://github.com/electron-userland/electron-builder/issues/8149
提出此 PR 是为了解决问题 https://github.com/electron-userland/electron-builder/pull/8530 但尚未合并。