19

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! puppeteer@1.20.0 install: `node install.js`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the puppeteer@1.20.0 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Bahadur Singh Deol
  • 753
  • 2
  • 6
  • 17
  • Following answer might help: https://stackoverflow.com/questions/53283809/yarn-install-error-failed-to-download-chromium – M.A.Naseer Dec 16 '19 at 19:11

6 Answers6

22

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
Nazmul Hosen
  • 361
  • 2
  • 10
  • 5
    You can add little more description, like how to add environment variable in Mac or windows.For those of who are new bee like me in mac, run this command in your terminal, nano ~/.bash_profile and add export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true and hit ctrl + o on mac to save and ctrl + x to exit window. Then run source ~/.bash_profile to refresh the terminal then go ahead with your work. – Vasanth Jun 18 '21 at 11:33
6

I fixed it by installing Chromium manually using this command:

node node_modules/puppeteer/install.js
Afshin Ghazi
  • 2,784
  • 4
  • 23
  • 37
2

I had same issue with puppeteer@1.20 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

Ultradoxx
  • 668
  • 7
  • 14
2

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

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 20 '21 at 00:49
0

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!!!

Velu
  • 1,681
  • 1
  • 22
  • 26
0

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
daniel gi
  • 396
  • 1
  • 7
  • 19