Skip to content

Commit

Permalink
fix(cli): resolve puppeteer relative to cwd too
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed May 21, 2020
1 parent 45dcc07 commit 456d662
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/cli/src/collect/puppeteer-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ class PuppeteerManager {
// @ts-ignore - puppeteer-core is API-compatible with puppeteer
return require('puppeteer-core');
} catch (_) {}

// Try relative to the CWD too in case we're installed globally
try {
return require(path.join(process.cwd(), 'node_modules/puppeteer'));
} catch (_) {}

try {
return require(path.join(process.cwd(), 'node_modules/puppeteer-core'));
} catch (_) {}
}

/** @return {Promise<import('puppeteer').Browser>} */
Expand Down

0 comments on commit 456d662

Please sign in to comment.