puppeteer: Error: Failed to launch chrome! spawn /app/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome ENOENT

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.11.0
  • Platform / OS version: MAC 10.14.3
  • URLs (if applicable):
  • Node.js version: v8.9.4

I have been trying to get my Node application, using Puppeteer as the testing framework to run via docker. It works perfectly well when running locally on my. However when running via container I keep running into the same issue.

I have tried almost every boiler-plate Dockerfile I have seen from other users online but none of them can address the issue Im seeing.

Error: Failed to launch chrome! spawn /app/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome ENOENT

When I see other people with this issue they all seem to show different linux versions and not the specific one I am seeing after download: linux-609904. What is the best way to audit whats wrong with this version?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 32
  • Comments: 24 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@arapocket Thanks for commenting—I forgot to follow up after I found a solution. It’s been a couple of weeks so I don’t remember exactly which change fixed it, but here’s the configuration I’m running:

In my Dockerfile I have

RUN apk add --nocache udev ttf-freefont chromium git
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV CHROMIUM_PATH /usr/bin/chromium-browser

// npm install, etc.

And then to launch the browser

puppeteer.launch({
  executablePath: process.env.CHROMIUM_PATH,
  args: ['--no-sandbox'], // This was important. Can't remember why
});

I also locked puppeteer to 1.17.0 in my package.json. I think that was to make the chromium and puppeteer versions match.

@arapocket Thanks for commenting—I forgot to follow up after I found a solution. It’s been a couple of weeks so I don’t remember exactly which change fixed it, but here’s the configuration I’m running:

In my Dockerfile I have

RUN apk add --nocache udev ttf-freefont chromium git
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV CHROMIUM_PATH /usr/bin/chromium-browser

// npm install, etc.

And then to launch the browser

puppeteer.launch({
  executablePath: process.env.CHROMIUM_PATH,
  args: ['--no-sandbox'], // This was important. Can't remember why
});

I also locked puppeteer to 1.17.0 in my package.json. I think that was to make the chromium and puppeteer versions match.

Thanks, this really helps a lot! Now, I can run puppeteer on my aws eb.

The only thing that needs to be fixed is to set the RUN options with --no-cache, instead of --nocache.

I have no idea why do we need these packages udev ttf-freefont git, so I remove them and only install the chromium. It works fine anyway.

I’m running puppeteer on node:12-alpine. After building the container, I’ve been shelling into it with docker run -ti [container] /bin/sh. I can then see that there is indeed a binary at /home/node/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome, but if I try to run it, I get the error /bin/sh: ./chrome: not found, which matches up with the ENOENT error that I get from puppeteer. I’ll follow up here if I find a solution, but I just wanted to point out that it might not be a failed download in case anyone else comes across this.

@ben-turner Thank you very much,

I had exactly the same issue, getting a: Error: Failed to launch chrome! spawn /builds/dev/ui/frontend/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome ENOENT when trying to run integration tests via Puppeteer in a Docker container (node:12-alpine) for my project’s CI (on Gitlab).

Running chromium from /usr/bin/chromium-browser instead of using Puppeteer’s chromium installation path solved it !

I have the same issues, but hasn’t resolved yet with this solution 😦

I have meet the same error when using prerender-spa-plugin inside docker

Failed to launch chrome! spawn /web/node_modules/prerender-spa-plugin/node_modules/puppeteer/.local-chromium/linux-624492/chrome-linux/chrome ENOENT

And here is the result of /web/node_modules/prerender-spa-plugin/node_modules/puppeteer/.local-chromium/linux-624492/chrome-linux

MEIPreload/ icudtl.dat locales/ natives_blob.bin xdg-mime chrome-wrapper libEGL.so nacl_helper product_logo_48.png xdg-settings chrome_100_percent.pak libGLESv2.so nacl_helper_bootstrap resources/
chrome_200_percent.pak libclearkeycdm.so nacl_irt_x86_64.nexe resources.pak

For those who do not have access to puppeteer options (like when using a package where puppeteer is a dependency), you can use the following solution with variable PUPPETEER_EXECUTABLE_PATH

RUN apk add --update --no-cache \
            chromium \
            nodejs \
            npm

# Do not use puppeteer embedded chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
ENV CHROMIUM_PATH="/usr/bin/chromium-browser"
ENV PUPPETEER_EXECUTABLE_PATH="${CHROMIUM_PATH}"

# Npm install...

Working example here: https://github.com/hardisgroupcom/sfdx-hardis/blob/main/Dockerfile

I’m running puppeteer on node:12-alpine. After building the container, I’ve been shelling into it with docker run -ti [container] /bin/sh. I can then see that there is indeed a binary at /home/node/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome, but if I try to run it, I get the error /bin/sh: ./chrome: not found, which matches up with the ENOENT error that I get from puppeteer. I’ll follow up here if I find a solution, but I just wanted to point out that it might not be a failed download in case anyone else comes across this.

I shelled into docker to try that and I got the same issue as well. EDIT: I’m on node:10-alpine for reference

@ben-turner Thank you very much,

I had exactly the same issue, getting a:
Error: Failed to launch chrome! spawn /builds/dev/ui/frontend/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome ENOENT when trying to run integration tests via Puppeteer in a Docker container (node:12-alpine) for my project’s CI (on Gitlab).

Running chromium from /usr/bin/chromium-browser instead of using Puppeteer’s chromium installation path solved it !

Error: Failed to launch chrome! spawn /app/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome ENOENT

@AdamBD the ENOENT error means there’s no executable file on your file system; you probably skipped or aborted chromium download.

I have tried almost every boiler-plate Dockerfile I have seen from other users online but none of them can address the issue Im seeing.

Have you tried our docker container? We run our own tests in a docker container and they work just fine.

Hope this helps

I’m having this problem running Puppeteer inside Digital Ocean Ubuntu

Late to the party, but Puppeteer has a section in the docs on how to run on Alpine docker.

https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-on-alpine

Hey everyone, I had the same issue today in my Node JS app running inside node:12.16.3-alpine image. I tried @ben-turner solution and I just wanted to point out that instead of --nocache consider using --no-cache since it gave me an error pointing it out. Context: In the apk add --no-cache

@artur79 Sorry for the confusion, eventually I didn’t, because grover does not support overriding the package name and it’s required based on puppeteer’s doc: const puppeteer = require('puppeteer-core');. So I ended up setting PUPPETEER_SKIP_CHROMIUM_DOWNLOAD env var + using chromium alpine package + passing executable_path: '/usr/bin/chromium-browser' to grover config and it worked well for me.

@bboydflo I use puppeteer with ruby and unoconv on apline. Here is Dockerfile I use: https://gist.github.com/knapo/3c146ff45da43822edabd6f46bfd3f39. If you don’t need ruby you can probably use pure alpine as a base.

Additionally, I have executablePath (puppeteer’s config) set to /usr/bin/chromium-browser

I’m using puppeteer and grover on alpine and was also getting:

Grover::JavaScript::Error:
Failed to launch the browser process! spawn [FILTERED]/node_modules/puppeteer/.local-chromium/linux-818858/chrome-linux/chrome ENOENT

Installing chromium from alpine packages and custom executablePath (also executable_path option in grover) solved the issue.

Instead PUPPETEER_SKIP_CHROMIUM_DOWNLOAD env var, I used puppeteer-core package.

Thanks for the hints!