Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical doesn't run on M1 chips #98

Open
thejimbirch opened this issue Nov 4, 2022 · 3 comments
Open

Critical doesn't run on M1 chips #98

thejimbirch opened this issue Nov 4, 2022 · 3 comments
Labels

Comments

@thejimbirch
Copy link
Contributor

No description provided.

@earthday47
Copy link
Contributor

earthday47 commented Nov 8, 2022

Running down the dependency tree:
critical -> penthouse -> puppeteer -> chromium

Problem 1 - even the latest version of penthouse is pinned to an old version of puppeteer (2.1.1) so that had to be replaced in package.json:

  "engines": {
    "npm": ">=8.3.0"
  },
  "overrides": {
    "puppeteer": "~19.2.2"
  }

Main Problem -
Puppeteer does not download an arm64 build by default, and chromium does not supply a build (they might now)
puppeteer/puppeteer#7740

Most suggestions are to skip the auto-download and install chromium manually.
https://github.com/it-novum/puppeteer-docker/blob/development/Dockerfile

There are some ENV variables that come into play (unclear which of these work)

PUPPETEER_SKIP_DOWNLOAD
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
PUPPETEER_EXECUTABLE_PATH

And settings can be passed down when calling critical.generate to try to use the natively built chromium:

        ...
        penthouse: {
          puppeteer: {
            executablePath: '/usr/bin/chromium',
            args: ['--disable-gpu', '--disable-setuid-sandbox', '--no-sandbox'],
            headless: true
          }
        }
        ...

@earthday47
Copy link
Contributor

earthday47 commented Nov 8, 2022

Solution #1 - build chromium manually

Make sure puppeteer is replaced with the latest as described above ^
Update the critical.generate call to:

critical.generate({
...
        penthouse: {
          puppeteer: {
            args: ['--disable-gpu', '--disable-setuid-sandbox', '--no-sandbox'],
            headless: true
          }
        }
...

Create docksal-local.yml with contents:

services:
  cli:
    environment:
      - PUPPETEER_SKIP_DOWNLOAD=true
      - PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium

Run the command to install chromium and dependencies manually (fin theme etc)
sudo apt-get install -yq --no-install-recommends chromium

@earthday47
Copy link
Contributor

earthday47 commented Jul 11, 2023

https://github.com/kanopi/hanson-bridgett/pull/277 is a recent real-world example

update theme-tools command, install chromium
sudo apt-get install -yq --no-install-recommends chromium

Update docksal.yml

services:
  cli:
    environment:
      # manually compile Chromium
      - PUPPETEER_SKIP_DOWNLOAD=true
      - PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium

in package.json, spoof puppeteer version so we get a more recent version (may not be needed)

    "puppeteer": "~19.2.2"
  },```

@thejimbirch thejimbirch added the bug label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants