comment-webpage-screenshot icon indicating copy to clipboard operation
comment-webpage-screenshot copied to clipboard

Screenshot fails to be taken: Error: Could not find Chromium

Open jwr0 opened this issue 2 years ago • 0 comments
trafficstars

This action looks great but it doesn't work when I try it. My use case it to build a static site with hugo, then take a screenshot of the HTML file which was built. Here's my YAML:

name: Screenshot Commenter

on:
  pull_request:
    types:
      - opened
      - reopened
      - synchronize

jobs:
  deploy:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: 'latest'

      - name: Build
        run: hugo --minify

      - name: cat index.html for debugging
        run: cat public/index.html

      # Run Screenshot Comment Action
      - name: Run Screenshot Comment Action
        uses: saadmk11/comment-website-screenshot@main
        with:
          upload_to: github_branch
          # Capture Screenshots of Changed HTML Files
          capture_changed_html_files: no
          # Comma seperated paths to any other HTML File
          capture_html_file_paths: "public/index.html"

Note that the cat public/index.html step does show the expected content in the raw HTML file.

Here's the error I get from the screenshot action:

Capture Screenshot for "public/index.html"
  Error: Could not find Chromium (rev. 1095492). This can occur if either
   1. you did not perform an installation before running the script (e.g. `npm install`) or
   2. your cache path is incorrectly configured (which is: /github/home/.cache/puppeteer).
  For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
      at ChromeLauncher.resolveExecutablePath (file:///usr/lib/node_modules/capture-website-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:101:27)
      at ChromeLauncher.executablePath (file:///usr/lib/node_modules/capture-website-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:177:25)
      at ChromeLauncher.launch (file:///usr/lib/node_modules/capture-website-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:64:37)
      at async internalCaptureWebsite (file:///usr/lib/node_modules/capture-website-cli/node_modules/capture-website/index.js:149:33)
      at async file:///usr/lib/node_modules/capture-website-cli/cli.js:289:24
  Error: Error while trying to Capture Screenshot for "public/index.html". Error: b''

I also tried uses: saadmk11/[email protected], but with the same result.

jwr0 avatar Feb 16 '23 23:02 jwr0