electron 无法使用手动方法构建电子

tzcvj98z  于 2023-03-06  发布在  Electron
关注(0)|答案(1)|浏览(149)

我尝试在Ubuntu 22.04上使用附加脚本构建electron(master)。它抛出以下错误(e build不报告此错误)。我使用的是最新的depot_tools、gn和node.js。请帮助:

root@acs-x86-node1-ghatwala-rhel:/electron/src# gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
ERROR at //electron/BUILD.gn:110:20: Script returned non-zero exit code.
electron_version = exec_script("script/print-version.py",
                   ^----------
Current dir: /electron/src/out/Release/
Command: python3 /electron/src/electron/script/print-version.py
Returned 1 and printed out: 0a>\n/electron/src/electron/script/lib/get-version.js:19\n    throw new Error('Failed to get current electron version');\n    ^\n\nError: Failed to get current electron version\n    at module.exports.getElectronVersion (/electron/src/electron/script/lib/get-version.js:19:11)\n    at [eval]:1:37\n    at Script.runInThisContext (node:vm:129:12)\n    at Object.runInThisContext (node:vm:307:38)\n    at node:internal/process/execution:83:21\n    at [eval]-wrapper:6:24\n    at runScript (node:internal/process/execution:82:62)\n    at evalScript (node:internal/process/execution:104:10)\n    at node:internal/main/eval_string:50:3\n\nNode.js v19.3.0\n"
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['node', '-p', 'require("./script/lib/get-version").getElectronVersion()']' returned non-zero exit status 1.
See //electron/build/args/all.gn:2:21: which caused the file to be included.
root_extra_deps = [ "//electron" ]
                    ^-----------
mkdir electron && cd electron
gclient config --name "src/electron" --unmanaged https://github.com/electron/electron
gclient sync --with_branch_heads --with_tags --no-history
cd src
export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
ninja -C out/Release electron
3zwjbxry

3zwjbxry1#

对我来说,这个问题是因为命令 git describe --tags --abbrev=0 在electron repo的python脚本中出现了故障。我在这里修复了repo(https://stackoverflow.com/a/45730454/3837653),它被修复了。希望这对大家有所帮助。

相关问题