missing dependencies when running playwright in docker
Asked Answered
B

3

14

I tried to run the playwright in docker but got this error:

browserType.launch: Host system is missing dependencies!

Missing libraries are:
  libvpx.so.6
  libicui18n.so.66
  libicuuc.so.66
  libwoff2dec.so.1.0.2
  libharfbuzz-icu.so.0
  libgstgl-1.0.so.0
  libgstcodecparsers-1.0.so.0
  libjpeg.so.8
  libenchant.so.1
  libsecret-1.so.0
  libhyphen.so.0
  libGLESv2.so.2

Then I tried to install the necessary libs to make the bundled version of playwright work by adding:

RUN apt-get update && apt-get install -y wget --no-install-recommends \
    && apt-get update \
    && apt-get install -y \
    libvpx6 \
    lib64icui18n66 \
    libicuuc66 \
    ....

But I still get these errors:

E: Unable to locate package libvpx6 // I tried with libvpx5 but got the same error
E: Unable to locate package lib64icui18n66
E: Unable to locate package libicuuc66
....

Docker OS

Distributor ID: Debian
Description:    Debian GNU/Linux 9.13 (stretch)
Release:        9.13
Codename:       stretch

Anyone can help?

Byssus answered 20/1, 2021 at 2:37 Comment(3)
Are you using the playwright image?Sungkiang
@Sungkiang I have a node project that runs the playwright and I add all to the docker by commands: ... WORKDIR /app ADD . ./ RUN yarn install ...Byssus
There's a new Docker image from Microsoft with playwright installed: github.com/microsoft/playwright/issues/26482Kermes
M
13

With modern versions of playwright, you can easily add the necessary packages to any container with the following command:

npx playwright install-deps

This is much better than manually installing them because it will stay in sync with playwright updates.


Note: The previous answer, while technically correct, will bloat your container with a heavy layer that you probably don't need.

Matti answered 29/4, 2023 at 16:24 Comment(0)
B
1

Add this to your docker file

FROM mcr.microsoft.com/playwright:v1.6.2-focal

The above command should add all those missing dependencies to launch the tests.

Bartels answered 11/2, 2021 at 4:46 Comment(3)
do you know the one for debian 10? thanks.Merbromin
It should be the same. could you check this one in Debian ?Bartels
thanks! (switched to ubuntu for other raesons as well)Merbromin
L
0

For those who use Python with Playwright: playwright install-deps

Limber answered 2/7, 2024 at 20:12 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.