优化 puppeteer
This commit is contained in:
parent
897d66c480
commit
9a7fd50c65
|
@ -1,5 +1,5 @@
|
|||
const os = require("os")
|
||||
const { existsSync, realpathSync } = require("fs")
|
||||
const { existsSync } = require("fs")
|
||||
const { execSync } = require("child_process")
|
||||
const arch = os.arch()
|
||||
|
||||
|
@ -11,21 +11,20 @@ if (process.platform == "linux" || process.platform == "android")
|
|||
"chromium",
|
||||
"chromium-browser",
|
||||
"chrome",
|
||||
"chrome-browser",
|
||||
]) try {
|
||||
const chromiumPath = execSync(`command -v ${item}`).toString().trim()
|
||||
if (chromiumPath && existsSync(chromiumPath)) {
|
||||
executablePath = realpathSync(chromiumPath)
|
||||
executablePath = chromiumPath
|
||||
break
|
||||
}
|
||||
} catch (err) {}
|
||||
|
||||
if (!executablePath) for (const item of [
|
||||
"C:/Program Files/Google/Chrome/Application/chrome.exe",
|
||||
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
|
||||
"/usr/bin/chromium",
|
||||
"/usr/bin/chromium-browser",
|
||||
"/snap/bin/chromium",
|
||||
"/usr/bin/chrome",
|
||||
"C:/Program Files/Google/Chrome/Application/chrome.exe",
|
||||
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
|
||||
]) if (existsSync(item)) {
|
||||
executablePath = item
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue