Failed to set up Chromium! Set "PUPPETEER_SKIP_DOWNLOAD"

avatar
Borislav Hadzhiev

Last updated: Apr 5, 2024
3 min

banner

# Failed to set up Chromium! Set "PUPPETEER_SKIP_DOWNLOAD"

The error "ERROR: Failed to set up Chromium r800071! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download." occurs when your environment fails to set up the Chromium browser when installing Puppeteer.

To solve the error, set the PUPPETEER_SKIP_DOWNLOAD environment variable to true and rerun the installation command.

Here is the complete error message.

shell
ERROR: Failed to set up Chromium r800071! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download. Error: self-signed certificate in certificate chain

Open your terminal in your project's root directory (where your package.json) file is and set the PUPPETEER_SKIP_DOWNLOAD environment variable to true.

If you are on macOS or Linux, run the following command in bash or zsh.

shell
# For macOS and Linux export PUPPETEER_SKIP_DOWNLOAD=true export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer

set puppeteer skip download environment variable true

If you are on Windows and use CMD (Command Prompt), run the following command.

cmd
# For Windows (Command Prompt) SET PUPPETEER_SKIP_DOWNLOAD=true SET PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer

If you are on Windows and use PowerShell, use the following command instead.

PowerShell
# For Windows (Power Shell) $env:PUPPETEER_SKIP_DOWNLOAD="true" $env:PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" npm install puppeteer

After you set the environment variable, try to rerun the installation command.

shell
npm install puppeteer

# Install puppeteer using --unsafe-perm

If the issue persists, try to install the puppeteer module using the --unsafe-perm flag.

shell
npm install puppeteer --unsafe-perm=true

install puppeteer with unsafe perm flag

The --unsafe-perm flag forces npm to download the package's binary.

If the error persists, try to add the --allow-root flag.

shell
npm install puppeteer --unsafe-perm=true --allow-root

install puppeteer using allow root flag

If that didn't work either, try setting the --ignore-scripts flag.

When the flag is set, the package's pre-install and post-install scripts won't run.

shell
npm install puppeteer --ignore-scripts

install puppeteer with ignore scripts flag

You can also set the flag when using yarn.

shell
yarn add --ignore-scripts puppeteer

# Install the long-term supported version of Node.js

If the error persists, it is most likely caused by your Node.js version.

There are 2 main ways to install the LTS version of Node.js:

  1. You can download the long-term supported Node.js version from the official nodejs.org website.
  2. You can use the nvm module to manage your Node.js version.

If you already have nvm installed issue to following 2 commands to switch to the LTS version.

shell
nvm install --lts nvm use --lts

If you don't have nvm installed, click on the link that relates to your operating system:

After you install the long-term supported version and switch to it, try to install the puppeteer package.

shell
npm install puppeteer

You can use the node -v command to verify that you are running the LTS version of Node.

shell
node -v

If none of the suggestions helped, you can try to set the PUPPETEER_DOWNLOAD_HOST environment variable before installing the module.

shell
npm config set PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors npm install puppeteer

If that doesn't resolve the issue, remove the configuration property.

shell
npm config rm PUPPETEER_DOWNLOAD_HOST

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.