From 30e1b1be9a52c4cc91c7687cce2fa72c60077a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=80=E6=9C=89=E4=BA=8C=E5=88=BA=E8=9E=88=E9=83=BD?= =?UTF-8?q?=E5=BE=97=E6=AD=BB?= <321107534@qq.com> Date: Mon, 7 Aug 2023 02:53:43 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Darm64=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E4=B8=8B=E8=BD=BDchromium=20=E5=8E=9F?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E4=BB=A3=E7=A0=81=E4=B8=BA=E5=8F=AA=E8=A6=81?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=B8=BAarm64=E5=B0=B1=E4=BC=9A=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E8=B7=B3=E8=BF=87=E4=B8=8B=E8=BD=BD=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E8=AE=BA=E6=98=AF=E4=BD=BF=E7=94=A8pnpm=20i=20puppeteer=20-w?= =?UTF-8?q?=E8=BF=98=E6=98=AFnode=20node=5Fmodules/puppeteer/install.js?= =?UTF-8?q?=EF=BC=8C=E9=83=BD=E6=97=A0=E6=B3=95=E5=AE=89=E8=A3=85=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=EF=BC=8C=E5=8F=AA=E8=83=BD=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=8F=A6=E5=A4=96=E5=AE=89=E8=A3=85=E5=AE=8C=E6=95=B4chrome=20?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E4=BF=AE=E6=94=B9=E4=B8=BAarm64=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E5=88=B0=E5=AE=89=E8=A3=85=E8=BF=87chromium=E6=89=8D?= =?UTF-8?q?=E4=BC=9A=E8=B7=B3=E8=BF=87=E4=B8=8B=E8=BD=BD=EF=BC=8C=E6=96=B9?= =?UTF-8?q?=E4=BE=BF=E5=AE=89=E8=A3=85puppeteer=E5=B8=A6=E7=9A=84chromium?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 所有二刺螈都得死 <321107534@qq.com> --- .puppeteerrc.cjs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.puppeteerrc.cjs b/.puppeteerrc.cjs index 253d90c..c3875f5 100644 --- a/.puppeteerrc.cjs +++ b/.puppeteerrc.cjs @@ -3,22 +3,20 @@ const { existsSync } = require("fs"); const arch = os.arch(); let skipDownload = false; let executablePath; -//win32 存在 Edge 优先选择 + +// win32 存在 Edge 优先选择 if (process.platform == "win32") { - if ( - existsSync("C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe") - ) { + if (existsSync("C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe")) { skipDownload = true; - executablePath = - "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"; + executablePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"; } } else if (process.platform == "linux") { - //如果arm64架构跳过下载 - if (arch == "arm64" || arch == "aarch64") { + // 如果 arm64 架构且存在 Chromium,跳过下载 + if ((arch == "arm64" || arch == "aarch64") && existsSync("/usr/bin/chromium")) { skipDownload = true; - } - //不管什么架构,如果存在配置则跳过下载,且配置路径 - if (existsSync("/usr/bin/chromium")) { + executablePath = "/usr/bin/chromium"; + } else if (existsSync("/usr/bin/chromium")) { + // 不论什么架构,如果存在 Chromium,跳过下载且配置路径 skipDownload = true; executablePath = "/usr/bin/chromium"; } @@ -30,4 +28,4 @@ if (process.platform == "win32") { module.exports = { skipDownload, executablePath, -}; \ No newline at end of file +};