Skip to content

Commit

Permalink
fix: Allow PUPPETEER_EXECUTABLE_PATH to be set in npmrc and package.j…
Browse files Browse the repository at this point in the history
…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 a79b775
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Launcher.js
Expand Up @@ -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 };
Expand Down

0 comments on commit a79b775

Please sign in to comment.