Bahadur Singh Deol
Bahadur Singh Deol

Reputation: 821

ERROR: Failed to download Chromium r686378! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download

I am trying to install react-snap using this command 'sudo npm install --save-dev react-snap' in ubuntu 18 it's give me the error

ERROR: Failed to download Chromium r686378! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.

after search i will get the solution to run this command

sudo npm install -g puppeteer --unsafe-perm=true --allow-root

after running this command still, i am facing this error, My react version is 16.8

    ERROR: Failed to download Chromium r686378! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] install: `node install.js`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the [email protected] install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Upvotes: 24

Views: 40243

Answers (6)

daniel gi
daniel gi

Reputation: 436

If you are using docker, add this to your dockerfile:


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

# Install Puppeteer @latest version.
RUN npm i puppeteer@latest

Upvotes: 1

Velu
Velu

Reputation: 1911

In our case, when we try to install "aws-azure-login" using npm install, our enterprise proxy client trying to inspect the SSL traffic by presenting its own Self Signed certificate which is trusted in my local truststore. So we have to download these CAcert using OpenSSL commands & using "NODE_EXTRA_CA_CERTS" argument to specify the additional downloaded cert path, we were able to download & install the puppeteer on my MacOS.

Here are the steps:

  1. download the CAcert that enterprise proxy presents when we try to connect to any domain [storage.googleapis.com].

    > openssl s_client -showcerts -verify 5 -servername storage.googleapis.com -connect storage.googleapis.com:443 < /dev/null | awk '/BEGIN/,/END/{ if(/BEGIN/){a++}; out="cert"a".crt"; print >out}' && for cert in *.crt; do newname=$(openssl x509 -noout -subject -in $cert | sed -n 's/^.*CN=\(.*\)$/\1/; s/[ ,.*]/_/g; s/__/_/g; s/^_//g;p').pem; mv $cert $newname; done
    
  2. The above command will download all the domain, intermediate & root certificates of the Proxy. Concatenate all the certificates into a single PEM file.

    cat domain1.crt intermediate.crt root.crt >extra_cacert.pem

  3. Specify the NODE_EXTRA_CA_CERTS argument while installing the puppeteer using npm

    NODE_EXTRA_CA_CERTS=./extra_cacert.pem node /Users/velayutham/aws-azure-login/node_modules/puppeteer/install.js

The above steps were tested in MacOS!!!

Upvotes: 0

alper ariyurek
alper ariyurek

Reputation: 39

PS C:\Users\myuser> $env:PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=0
PS C:\Users\myuser> npm install  puppeteer --unsafe-perm=true --allow-root 

works at my local windows10. similar issues https://github.com/puppeteer/puppeteer/issues/2173

Upvotes: 3

Nazmul Hosen
Nazmul Hosen

Reputation: 421

The best way is to export default env var PUPPETEER_SKIP_CHROMIUM_DOWNLOAD

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn add puppeteer or
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer

Upvotes: 26

Afshin Ghazi
Afshin Ghazi

Reputation: 2990

I fixed it by installing Chromium manually using this command:

node node_modules/puppeteer/install.js

Upvotes: 6

Ultradoxx
Ultradoxx

Reputation: 738

I had same issue with [email protected] install when trying to run npm i aws-azure-login on mac, after doing sudo npm install -g puppeteer --unsafe-perm=true --allow-root. It seems Puppeteer doesn't install globally with execution permissions for all users so you'll need to modify them (https://libraries.io/npm/aws-azure-login). You can try sudo chmod -R go+rx $(npm root -g)

I finally got aws-azure-login to install without any issues by changing npm default behavior to install global packages in my home directory:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
source ~/.profile

See https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

Upvotes: 2

Related Questions