Skip to content

Commit e9362d5

Browse files
committed
fix: do not use local Chrome in Puppeteer
1 parent e3c61d5 commit e9362d5

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

src/utils.ts

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { readFileSync, readdirSync, statSync } from "fs";
22
import path from "path";
3-
import puppeteer from "puppeteer";
43
import { VERSION as currentVersion } from "./versions.js";
54

65
export interface AuditI {
@@ -99,31 +98,24 @@ const getPathDirectoryInDirectory = (startPath: string) => {
9998
};
10099

101100
const getChromePath = () => {
102-
try {
103-
return puppeteer.executablePath();
104-
} catch {
105-
let chromeFilePath = path.join(
106-
import.meta.dirname,
107-
"../",
108-
"chrome-headless-shell",
109-
);
110-
if (process.env.NODE_ENV?.toString().trim() !== "development") {
111-
chromeFilePath = path.join(
112-
process.resourcesPath,
113-
"chrome-headless-shell",
114-
);
115-
}
116-
117-
chromeFilePath = getPathDirectoryInDirectory(chromeFilePath);
118-
chromeFilePath = getPathDirectoryInDirectory(chromeFilePath);
119-
chromeFilePath = path.join(chromeFilePath, "chrome-headless-shell");
101+
let chromeFilePath = path.join(
102+
import.meta.dirname,
103+
"../",
104+
"chrome-headless-shell",
105+
);
106+
if (process.env.NODE_ENV?.toString().trim() !== "development") {
107+
chromeFilePath = path.join(process.resourcesPath, "chrome-headless-shell");
108+
}
120109

121-
if (process.platform === "win32") {
122-
chromeFilePath += ".exe";
123-
}
110+
chromeFilePath = getPathDirectoryInDirectory(chromeFilePath);
111+
chromeFilePath = getPathDirectoryInDirectory(chromeFilePath);
112+
chromeFilePath = path.join(chromeFilePath, "chrome-headless-shell");
124113

125-
return chromeFilePath;
114+
if (process.platform === "win32") {
115+
chromeFilePath += ".exe";
126116
}
117+
118+
return chromeFilePath;
127119
};
128120

129121
const checkNewerRelease = async () => {

0 commit comments

Comments
 (0)