简体   繁体   English

错误:无法下载 Chromium r686378! 设置“PUPPETEER_SKIP_CHROMIUM_DOWNLOAD”环境变量以跳过下载

[英]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我正在尝试在 ubuntu 18 中使用此命令 'sudo npm install --save-dev react-snap' 安装 react-snap 它给了我错误

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仍然运行此命令后,我面临此错误,我的反应版本是 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.

The best way is to export default env var PUPPETEER_SKIP_CHROMIUM_DOWNLOAD最好的方法是导出默认环境变量 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD

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

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 .在执行sudo npm install -g puppeteer --unsafe-perm=true --allow-root之后,尝试在 mac 上运行npm i aws-azure-login时,我在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 ).似乎 Puppeteer 不会全局安装并为所有用户提供执行权限,因此您需要修改它们( https://libraries.io/npm/aws-azure-login )。 You can try sudo chmod -R go+rx $(npm root -g)你可以试试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:通过更改 npm 默认行为以在我的主目录中安装全局包,我终于让 aws-azure-login 安装没有任何问题:

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请参阅https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

我通过使用以下命令手动安装 Chromium 来修复它:

node node_modules/puppeteer/install.js

npm install puppeteer --unsafe-perm=true works at my local windows10. npm install puppeteer --unsafe-perm=true 适用于我的本地 windows10。 similar issues https://github.com/puppeteer/puppeteer/issues/2173类似问题https://github.com/puppeteer/puppeteer/issues/2173

In our case, when we try to install "aws-azure-login"<\/strong> using npm install, our enterprise proxy<\/a> client trying to inspect the SSL traffic by presenting its own Self Signed certificate which is trusted in my local truststore.在我们的例子中,当我们尝试使用 npm install 安装“aws-azure-login”时<\/strong>,我们的企业代理<\/a>客户端尝试通过提供自己的自签名证书来检查 SSL 流量,该证书在我的本地信任库中受信任。 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.所以我们必须使用 OpenSSL 命令下载这些 CAcert 并使用“NODE_EXTRA_CA_CERTS”参数来指定额外下载的证书路径,我们能够在我的 MacOS 上下载和安装 puppeteer。

Here are the steps:以下是步骤:

  1. download the CAcert that enterprise proxy presents when we try to connect to any domain [storage.googleapis.com].当我们尝试连接到任何域 [storage.googleapis.com] 时,下载企业代理提供的 CAcert。

     > 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<\/code><\/pre><\/li>
  2. The above command will download all the domain, intermediate & root certificates of the Proxy.上述命令将下载代理的所有域、中间和根证书。 Concatenate all the certificates into a single PEM file.将所有证书连接到一个 PEM 文件中。

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

    <\/blockquote><\/li>

  3. Specify the NODE_EXTRA_CA_CERTS argument while installing the puppeteer using npm使用 npm 安装 puppeteer 时指定 NODE_EXTRA_CA_CERTS 参数

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

    <\/blockquote><\/li><\/ol>

    The above steps were tested in MacOS!!!<\/strong><\/strong><\/em>以上步骤是在MacOS中测试的!!!<\/strong><\/strong><\/em>

    "

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM