Skip to content
Browse files

fix: Allow PUPPETEER_EXECUTABLE_PATH to be set in npmrc and package.j…

…son (#4270)

This PR sets fixes the PUPPETEER_EXECUTABLE_PATH environment variable so that it can be set in the .npmrc or package.json like the documentation says.

The npm environment is initialized if puppeteer script is run from-inside `npm run` command.
  • Loading branch information...
travis-w authored and aslushnikov committed Apr 11, 2019
1 parent 08e9a4d commit a79b775430d80f546850c322d39cb77879a5a5b9
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Launcher.js
@@ -298,7 +298,7 @@ class Launcher {
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'];
const executablePath = process.env.PUPPETEER_EXECUTABLE_PATH || process.env.npm_config_puppeteer_executable_path || process.env.npm_package_config_puppeteer_executable_path;
if (executablePath) {
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 };

0 comments on commit a79b775

Please sign in to comment.
You can’t perform that action at this time.