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

@puppeteer/browsers package doesn't install dependencies #121

Open
SamStephens opened this issue Mar 26, 2024 · 4 comments
Open

@puppeteer/browsers package doesn't install dependencies #121

SamStephens opened this issue Mar 26, 2024 · 4 comments

Comments

@SamStephens
Copy link

SamStephens commented Mar 26, 2024

The README.md and official blog post both make it look as though installing via @puppeteer/browsers will give you working Chrome browsers.

However, installing this way does not provide all the required dependencies. If I run my reproduction Dockerfile

FROM python:3.11-bookworm # Based on Debian Bookwork

RUN apt-get update --fix-missing && apt-get upgrade -y && apt-get dist-upgrade -y

RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get install -y nodejs

RUN npx @puppeteer/browsers install [email protected] | \
  awk '{print $2}' | \
  xargs -I {} ln --symbolic {} /usr/local/bin/chrome
RUN npx @puppeteer/browsers install [email protected]  | \
  awk '{print $2}' | \
  xargs -I {} ln --symbolic {} /usr/local/bin/chromedriver

ENTRYPOINT /usr/local/bin/chromedriver

I get the error

/usr/local/bin/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

This is talked about somewhat in #55, where people detail their various workarounds for installing the dependencies. I've raised this issue separately, because #55 is talking about instructions being missing entirely for installation from the ZIP files, whereas my concern is that the provided instructions for using @puppeteer/browsers are incomplete and misleading.

There should be an officially blessed way to install the dependencies; it's unfortunate that the consumers of chrome-for-testing are guessing how to best install the dependencies.

@thiagowfx
Copy link
Contributor

Proposed workaround: https://serverfault.com/questions/577942/install-only-dependencies-of-a-given-package-in-debian-or-ubuntu-apt

TL;DR:

sudo apt `apt-cache depends google-chrome | awk '/Depends:/{print$2}'`

Nonetheless, I'd argue that this bug belongs to https://github.com/puppeteer/puppeteer instead of this repository.

@SamStephens
Copy link
Author

@thiagowfx I think it probably belongs here, because users who download the zip files themselves without using Puppeteer also face the same issue.

I'm aware of the various workarounds I've seen being discussed.

My point here is that Chrome for Testing should provide official guidance; that it is not "a dedicated flavor of Chrome targeting the testing use case" [1] if the repository does not provide a self-contained way to install fully functioning Chrome (which includes dependencies).

[1] From https://developer.chrome.com/blog/chrome-for-testing/

@ngan
Copy link

ngan commented May 2, 2024

FWIW, this was the trick I used (from Dockerfile, on Ubuntu):

    wget --quiet -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
    && apt-get update \
    && apt-get install --yes --no-install-recommends google-chrome-stable \
    && apt-get remove --yes google-chrome-stable

Essentially install google-chrome-stable and its dependencies. Then uninstall google-chrome-stable leaving its dependencies behind.

@SamStephens
Copy link
Author

@ngan please, no more workarounds. I've seen them all. That's not the point. This is an product of Google, one of the largest tech companies in the world. We shouldn't need workarounds. There should be official guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants