mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: Allow PUPPETEER_EXECUTABLE_PATH to be set in npmrc and package.json (#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.
This commit is contained in:
parent
08e9a4ddaa
commit
a79b775430
@ -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 };
|
||||
|
Loading…
Reference in New Issue
Block a user