gpt4 book ai didi

node.js - Electron 生成器使用: ENOENT: no such file or directory,复制文件elevate.exe在 Jenkins 身上失败

转载 作者:行者123 更新时间:2023-12-03 12:39:13 28 4
gpt4 key购买 nike

我已经开始研究基于 Electron 的旧应用程序。作为这项工作的一部分,我需要更新许多软件包,包括 Electron 构建器。
在对所有软件包版本进行了许多调整之后,依此类推,我将应用程序构建在Windows 10的本地计算机上。
当我将构建推送到jenkins并尝试进行 Electron 构建时,出现以下错误: ENOENT:没有此类文件或目录,复制文件'/root/.cache/electron-builder/nsis/nsis-3.0.3.2/elevate .exe'->'/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/electron-packager/win32-x64/MYAPP-win32-x64/resources/elevate.exe'。
我了解这意味着该文件基本上不存在?我不知道这是怎么回事,因为相同的构建配置正在使用早期版本的electronic-builder构建应用程序,但现在不是。我使用了最新版本的 Electron 生成器,并顺利通过了所有版本。
jenkins服务器是CentOS,并且使用了docker-wine容器。我无法控制只能提交构建的实际构建服务器。
发生错误:

electron-builder --win --x64 --ia32 --pd="electron-packager/win32-x64/MYAPP-win32-x64" --config=builder.json

  • electron-builder  version=21.2.0 os=3.10.0-327.18.2.el7.x86_64
• artifacts will be published if draft release exists reason=CI detected
• loaded configuration file=/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/builder.json
• building target=nsis file=release/MYAPP Setup 3.0.3.exe archs=x64, ia32 oneClick=false perMachine=true
• downloading url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z size=1.4 MB parts=1
• downloaded url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z duration=6.237s
⨯ ENOENT: no such file or directory, copyfile '/root/.cache/electron-builder/nsis/nsis-3.0.3.2/elevate.exe' -> '/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/electron-packager/win32-x64/MYAPP-win32-x64/resources/elevate.exe' stackTrace=
Error: ENOENT: no such file or directory, copyfile '/root/.cache/electron-builder/nsis/nsis-3.0.3.2/elevate.exe' -> '/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/electron-packager/win32-x64/MYAPP-win32-x64/resources/elevate.exe'
at processImmediate (internal/timers.js:458:21)
From previous event:
at NsisTarget.buildInstaller (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/app-builder-lib/src/targets/nsis/NsisTarget.ts:203:29)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at NsisTarget.finishBuild (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/app-builder-lib/src/targets/nsis/NsisTarget.ts:110:7)
at async Promise.all (index 2)
at AsyncTaskManager.awaitTasks (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/builder-util/src/asyncTaskManager.ts:65:25)
at Packager.doBuild (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/app-builder-lib/src/packager.ts:449:5)
at executeFinally (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/builder-util/src/promise.ts:12:14)
at Packager._build (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/app-builder-lib/src/packager.ts:366:31)
at Packager.build (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/app-builder-lib/src/packager.ts:330:12)
at executeFinally (/home/jenkins/workspace/MYAPP_myapp-client_master-BZL24OQAMKV5LCPISXOCH6VJELCMS26NKBSHJ6R43G746JVMSVBQ/node_modules/builder-util/src/promise.ts:12:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp-client@3.0.3 installer:win: `electron-builder --win --x64 --ia32 --pd="electron-packager/win32-x64/MYAPP-win32-x64" --config=builder.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp-client@3.0.3 installer:win script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-09-01T12_10_26_791Z-debug.log
[Pipeline]
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
ERROR: script returned exit code 1
Finished: FAILURE
软件包版本:
"electron-builder": "21.2.0",
"electron-packager": "7.6.0",
"electron": "8.5.0",
Builder.json:
{
"win": {
"icon": "app/ico/icon.ico"
},
"nsis": {
"oneClick": false,
"perMachine": true,
"include": "installer.nsh"
},
"directories": {
"output": "release"
}
}

最佳答案

我使用调试器运行了构建脚本,并且发现了一个标志,该标志是我解决该问题的方法。
该标志是here所描述的packElevateHelper,除非您确实需要提升功能,否则可以显式省略它,因此完全避免尝试在文件上进行复制。
例如,您的配置应具有包含以下属性的NSIS选项:

  "nsis": {
"packElevateHelper": false,
},
更新:
我刚刚确定了一种方法,可以通过 elevate.exe复制该通行证。
确保已在其中创建了应用程序 .exe文件的二进制输出文件夹也包含 resources文件夹。尝试将 copyfile复制到软件包中的 elevate.exe文件夹中以进行安装的 resources调用无法确保此文件夹已存在。
在我的情况下,使用将 prepackaged属性设置为我的二进制生成输出文件夹的程序化API,在创建目录后,我就简单地调用了 electron-builder build函数,如下所示:
fs.promises.mkdir(path.join(<path_to_binary_folder>, 'resources'));
当文件夹存在时,复制命令可以正常工作。

关于node.js - Electron 生成器使用: ENOENT: no such file or directory,复制文件elevate.exe在 Jenkins 身上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63722003/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com