Skip to content

Cannot spawn Chromium with custom executablePath on Apple M1 #6634

Closed
@yhatt

Description

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: puppeteer-core 5.5.0 (puppeteer could not install due to Installation fails on Apple Silicon / M1 #6622)
  • Platform / OS version: macOS Big Sur 11.0.1 (on Macbook Air, M1, 2020)
  • URLs (if applicable): No
  • Node.js version: v15.2.1 (arm64 build)

What steps will reproduce the problem?

Please include code that reproduces the issue.

  1. Install puppeteer-core
  2. Make test.js:
const puppeteer = require('puppeteer-core')

;(async () => {
  const browser = await puppeteer.launch({
    executablePath:
      '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
  })
  const page = await browser.newPage()
  await page.goto('https://example.com')
  await page.screenshot({ path: 'example.png' })

  await browser.close()
})()
  1. Run node ./test.js

What is the expected result?

Take a screenshot of https://example.com/ into example.png, with using custom executable path.

What happens instead?

Puppeteer tries to spawn not existed chromium path /usr/bin/chromium-browser.

/Users/yhatt/Programs/tmp/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:193
            reject(new Error([
                   ^

Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/Users/yhatt/Programs/tmp/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
    at ChildProcess.<anonymous> (/Users/yhatt/Programs/tmp/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:185:85)
    at ChildProcess.emit (node:events:329:20)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:275:12)
    at onErrorNT (node:internal/child_process:467:16)
    at processTicksAndRejections (node:internal/process/task_queues:80:21)

I think Puppeteer is always overriding executable path when running on arm64. (#5167)

if (os.arch() === 'arm64') {
chromeExecutable = '/usr/bin/chromium-browser';

UPDATE: #6495 may fix it.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions