puppeteer: hb_font_set_variations: symbol not found

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.4.0
  • Platform / OS version: Linux alpine
  • Node.js version: node 8.11.3

What steps will reproduce the problem?

Please include code that reproduces the issue.

Dockerfile

FROM node:8.11-alpine

RUN apk update && apk upgrade && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
    apk add --no-cache \
      chromium@edge \
      nss@edge

WORKDIR /app

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

RUN npm i puppeteer@1.4.0

COPY . .

# RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
#     && chown -R pptruser:pptruser /app

# USER pptruser

CMD ["node", "/app/index.js"]

index.js

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser', args: ['--no-sandbox', '--disable-setuid-sandbox']});
  const page = await browser.newPage();
  await page.goto('https://google.com');

  await browser.close();
})();
  • docker build -t foo/puppeteer .
  • docker run -it --rm foo/puppeteer

What is the expected result? Puppeteer should start, no errors.

What happens instead?

(node:1) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
Error relocating /usr/lib/chromium/chrome: hb_font_set_variations: symbol not found
Error relocating /usr/lib/chromium/chrome: hb_face_get_table_tags: symbol not found
Error relocating /usr/lib/chromium/chrome: hb_font_set_ptem: symbol not found


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

    at onClose (/app/node_modules/puppeteer/lib/Launcher.js:255:14)
    at Interface.helper.addEventListener (/app/node_modules/puppeteer/lib/Launcher.js:244:50)
    at emitNone (events.js:111:20)
    at Interface.emit (events.js:208:7)
    at Interface.close (readline.js:368:8)
    at Socket.onend (readline.js:147:10)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)

Things I have tried:

  • node:9-alpine
  • latest puppeteer
  • --cap-add=SYS_ADMIN

Related https://github.com/stereobooster/react-snap/issues/229

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 16
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry to add yet another solution without much of an explanation, but here’s my configuration that I got to work: (You could probably use @edge instead of @3.8, but I wanted to stick to more stable versions after getting burned by this today)

RUN apk update && \
  apk upgrade && \
  echo @3.8 https://ftp.acc.umu.se/mirror/alpinelinux.org/v3.8/community >> /etc/apk/repositories && \
  echo @3.8 https://ftp.acc.umu.se/mirror/alpinelinux.org/v3.8/main >> /etc/apk/repositories && \
  apk add --no-cache \
    freetype@3.8 \
    harfbuzz@3.8 \
    chromium@3.8 \
    nss@3.8

I’m assuming the rest of your configuration will work for you if it had been working already. The main idea behind this solution is adding the freetype and harfbuzz packages. Reaching this conclusion took two main steps:

  1. I googled the hb_font_set_variations symbol, and harfbuzz came up among the results. Installing harfbuzz@3.8 cleared the previous errors about the hb_-prefixed symbols, and a new error came up referring to a FT_Done_MM_Var symbol.
  2. I googled that symbol, and mentions of freetype came up. I installed freetype@3.8, and things finally ran smoothly.

Why? I don’t know.

I’ve been struggling with the same issue.

chromium@v3.8 (64.0.3282.168-r0) works for me 🔥

FROM node:8-alpine 

ENV CHROME_BIN=/usr/bin/chromium-browser
RUN echo @v3.8 http://nl.alpinelinux.org/alpine/v3.8/community >> /etc/apk/repositories && \
    echo @v3.8 http://nl.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
    apk add --no-cache \
      chromium@v3.8 \
      nss@v3.8

# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

Starting puppeteer with the following flags:

  const browser = await puppeteer.launch({
    executablePath: process.env.CHROME_BIN || undefined,
    args: ['--no-sandbox', '--headless', '--disable-gpu'],
  });

Thank you @fritz-c 👏 . The following Dockerfile works:

FROM node:carbon-alpine

RUN apk update && apk upgrade && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
    apk add --no-cache \
      chromium@edge \
      nss@edge \
      freetype@edge \
      harfbuzz@edge

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

RUN yarn add puppeteer

Just run in the same problem this worked for me:

Dockerfile

-FROM node:9-alpine
+FROM node:10-alpine

ARG REPOSITORY_MIRROR=http://dl-cdn.alpinelinux.org

-RUN echo $REPOSITORY_MIRROR/alpine/v3.6/community > /etc/apk/repositories && \
-    echo $REPOSITORY_MIRROR/alpine/v3.6/main >> /etc/apk/repositories

+RUN echo $REPOSITORY_MIRROR/alpine/v3.8/community > /etc/apk/repositories && \
+    echo $REPOSITORY_MIRROR/alpine/v3.8/main >> /etc/apk/repositories

RUN apk update && apk upgrade && \
    echo @edge $REPOSITORY_MIRROR/alpine/edge/community >> /etc/apk/repositories && \
    echo @edge $REPOSITORY_MIRROR/alpine/edge/main >> /etc/apk/repositories && \
    echo @edge $REPOSITORY_MIRROR/alpine/edge/testing >> /etc/apk/repositories && \
    apk add --no-cache chromium@edge nss@edge python alpine-sdk

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV CHROME_BIN=/usr/bin/chromium-browser
ENV CHROME_PATH=/usr/lib/chromium/

@mfix22 i’ve fixed this by specifying some more dependencies:

RUN apk update && apk upgrade && \
    echo http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
    echo http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
    apk add --no-cache \
      zlib-dev \
      xvfb \
      xorg-server \
      dbus \
      ttf-freefont \
      chromium \
      nss \
      ca-certificates \
      dumb-init

Seems to work for me on puppeteer 1.1.0