How to use the chrome-launcher/dist/utils.getPlatform function in chrome-launcher

To help you get started, we’ve selected a few chrome-launcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qlik-oss / after-work.js / commands / puppeteer / src / index.js View on Github external
static async getChromeExecutablePath(stable) {
    if (!stable) {
      const launcher = importCwd.silent('puppeteer');
      if (!launcher) {
        throw new Error(
          'Cannot find Chromium. Make sure you have puppeteer installed',
        );
      }
      const exePath = launcher.executablePath();
      return exePath;
    }
    const installations = await chromeFinder[getPlatform()]();
    if (installations.length === 0) {
      throw new Error('Chrome not installed');
    }
    return installations.pop(); // If you have multiple installed chromes return regular chrome
  }
github qlik-oss / after-work.js / commands / puppeteer / src / index.js View on Github external
static async getChromeExecutablePath(stable) {
    if (!stable) {
      const launcher = importCwd.silent('puppeteer');
      if (!launcher) {
        throw new Error(
          'Cannot find Chromium. Make sure you have puppeteer installed',
        );
      }
      const exePath = launcher.executablePath();
      return exePath;
    }
    const installations = await chromeFinder[getPlatform()]();
    if (installations.length === 0) {
      throw new Error('Chrome not installed');
    }
    return installations.pop(); // If you have multiple installed chromes return regular chrome
  }
github yarnaimo / vanilla-clipper / src / utils / index.ts View on Github external
export const findChrome = () => {
    if (!chromePath) {
        try {
            const platform = getPlatform()
            const [path] = chromeFinder[platform as 'darwin' | 'linux' | 'win32' | 'wsl']()
            if (!is.string(path)) {
                throw new Error()
            }

            chromePath = path
        } catch (error) {
            throw new Error(
                'Could not find a Chrome installation. If you have already installed Chrome, set the CHROME_PATH environment variable.'
            )
        }
    }
    return chromePath
}