From bafda9fbe7126b0adb07304bb3dc434ee67eeddf Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Mon, 15 Jul 2019 03:37:57 +0400 Subject: [PATCH] fix(launcher): ensure PUPPETEER_EXECUTABLE_PATH is used if set (#4677) Without this patch, Puppeteer exits with `Error: Unsupported platform: freebsd` on FreeBSD despite `PUPPETEER_EXECUTABLE_PATH` being set. --- lib/Launcher.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Launcher.js b/lib/Launcher.js index 8a92ab7486e..3e5f5031308 100644 --- a/lib/Launcher.js +++ b/lib/Launcher.js @@ -292,7 +292,6 @@ class Launcher { * @return {{executablePath: string, missingText: ?string}} */ _resolveExecutablePath() { - const browserFetcher = new BrowserFetcher(this._projectRoot); // puppeteer-core doesn't take into account PUPPETEER_* env variables. if (!this._isPuppeteerCore) { const executablePath = process.env.PUPPETEER_EXECUTABLE_PATH || process.env.npm_config_puppeteer_executable_path || process.env.npm_package_config_puppeteer_executable_path; @@ -300,6 +299,9 @@ class Launcher { const missingText = !fs.existsSync(executablePath) ? 'Tried to use PUPPETEER_EXECUTABLE_PATH env variable to launch browser but did not find any executable at: ' + executablePath : null; return { executablePath, missingText }; } + } + const browserFetcher = new BrowserFetcher(this._projectRoot); + if (!this._isPuppeteerCore) { const revision = process.env['PUPPETEER_CHROMIUM_REVISION']; if (revision) { const revisionInfo = browserFetcher.revisionInfo(revision);