Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望添加 chromium 镜像源 #1246

Closed
Cap32 opened this issue Oct 25, 2017 · 17 comments

Comments

@Cap32
Copy link

commented Oct 25, 2017

对不起,这不是一条 issue,但实在找不到提交建议的渠道。

新版本的 puppeteer 将支持通过配置环境变量 PUPPETEER_DOWNLOAD_HOST 来定义下载源,目前官方源在大陆实在十分令人感到抓狂。

希望采纳,十分感谢。

@chikara-chan

This comment has been minimized.

Copy link

commented Nov 3, 2017

+1

@fengmk2

This comment has been minimized.

Copy link
Member

commented Nov 3, 2017

已经配置了一个代理,请使用 https://storage.googleapis.com.cnpmjs.org

PUPPETEER_DOWNLOAD_HOST=https://storage.googleapis.com.cnpmjs.org npm i puppeteer

fengmk2 added a commit to cnpm/binary-mirror-config that referenced this issue Nov 3, 2017

fengmk2 added a commit to cnpm/binary-mirror-config that referenced this issue Nov 3, 2017

@fengmk2

This comment has been minimized.

Copy link
Member

commented Nov 3, 2017

cnpm i puppeteer 现在也会去代理自动下载了。

@yandongxu

This comment has been minimized.

Copy link

commented Dec 5, 2017

https://storage.googleapis.com.cnpmjs.org 挂了?

MissingSecurityHeaderYour request was missing a required header.Authorization
@vc1

This comment has been minimized.

Copy link

commented Jan 18, 2018

【已修复】cnpm/mirrors#170


现在用cnpm 安装puppeteer用的是cdn.npm.taobao.org这个镜像,但是里面的文件没有及时更新,安装脚本下载的chromium版本是根据puppeteer项目中package.json里定义的版本号下载的,这个版本号经常更新到最新版,然后安装的时候就报404了

比如这个就不存在:https://cdn.npm.taobao.org/dist/chromium-browser-snapshots/Win_x64/526987/chrome-win32.zip
https://npm.taobao.org/mirrors/chromium-browser-snapshots/
cnpm@5.1.1

C:\Users\user>cnpm i -g puppeteer
Downloading puppeteer to D:\Users\user\AppData\Roaming\npm\node_modules\puppeteer_tmp
Copying D:\Users\user\AppData\Roaming\npm\node_modules\puppeteer_tmp\_puppeteer@1.0.0@puppeteer to D:\Users\user\AppData\Roaming\npm\node_modules\puppeteer
Installing puppeteer's dependencies to D:\Users\user\AppData\Roaming\npm\node_modules\puppeteer/node_modules
[1/8] proxy-from-env@^1.0.0 installed at node_modules\_proxy-from-env@1.0.0@proxy-from-env
[2/8] progress@^2.0.0 installed at node_modules\_progress@2.0.0@progress
[3/8] mime@^1.3.4 installed at node_modules\_mime@1.6.0@mime
[4/8] debug@^2.6.8 installed at node_modules\_debug@2.6.9@debug
[5/8] ws@^3.0.0 installed at node_modules\_ws@3.3.3@ws
[6/8] https-proxy-agent@^2.1.0 installed at node_modules\_https-proxy-agent@2.1.1@https-proxy-agent
[7/8] extract-zip@^1.6.5 installed at node_modules\_extract-zip@1.6.6@extract-zip
[8/8] rimraf@^2.6.1 installed at node_modules\_rimraf@2.6.2@rimraf
execute post install 1 scripts...
[1/1] scripts.install puppeteer@1.0.0 run "node install.js"
ERROR: Failed to download Chromium r526987! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
Error: Download failed: server returned code 404. URL: https://cdn.npm.taobao.org/dist/chromium-browser-snapshots/Win_x64/526987/chrome-win32.zip
    at response (D:\Users\user\AppData\Roaming\npm\node_modules\puppeteer\lib\Downloader.js:228:21)
    at ClientRequest.require.request.res (D:\Users\user\AppData\Roaming\npm\node_modules\puppeteer\lib\Downloader.js:279:7)
    at Object.onceWrapper (events.js:254:19)
    at ClientRequest.emit (events.js:159:13)
    at HTTPParser.parserOnIncomingClient (_http_client.js:550:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:117:23)
    at TLSSocket.socketOnData (_http_client.js:439:20)
    at TLSSocket.emit (events.js:159:13)
    at addChunk (_stream_readable.js:265:12)
    at readableAddChunk (_stream_readable.js:252:11)
Install fail! Error: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c node install.js" error, exit code 1
Error: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c node install.js" error, exit code 1
    at ChildProcess.proc.on.code (D:\Users\user\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:74:21)
    at ChildProcess.emit (events.js:159:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
npminstall version: 3.2.1
npminstall args: D:\Program Files\nodejs\node.exe D:\Users\user\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --china --userconfig=C:\Users\user\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=http://registry.npm.taobao.org -g puppeteer
@SAOSO

This comment has been minimized.

Copy link

commented Jan 19, 2018

安装依旧失败
ERROR: Failed to download Chromium r526987! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
Error: Download failed: server returned code 404. URL: https://cdn.npm.taobao.org/dist/chromium-browser-snapshots/Win_x64/526987/chrome-win32.zip
at response (E:\code\PuppeteerDemo\node_modules_puppeteer@1.0.0@puppeteer\lib\Downloader.js:228:21)
at ClientRequest.require.request.res (E:\code\PuppeteerDemo\node_modules_puppeteer@1.0.0@puppeteer\lib\Downloader.js:279:7)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at HTTPParser.parserOnIncomingClient (_http_client.js:549:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
at TLSSocket.socketOnData (_http_client.js:438:20)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
× Install fail! Error: post install error, please remove node_modules before re
try!
Run "C:\Windows\system32\cmd.exe /d /s /c node install.js" error, exit code 1
Error: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c node install.js" error, exit code 1
at ChildProcess.proc.on.code (C:\Users\admin.DESKTOP-S4PVBPA\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:74:21)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
npminstall version: 3.3.0
npminstall args: C:\Program Files\nodejs\node.exe C:\Users\admin.DESKTOP-S4PVBPA\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --china --userconfig=C:\Users\admin.DESKTOP-S4PVBPA.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=http://registry.npm.taobao.org puppeteer --save

@vc1

This comment has been minimized.

Copy link

commented Jan 19, 2018

@SAOSO 可以设置环境变量然后用npm安装

PUPPETEER_DOWNLOAD_HOST=https://storage.googleapis.com.cnpmjs.org
npm i puppeteer
@fwh1990

This comment has been minimized.

Copy link

commented Jan 20, 2018

如果使用npm config set的形式。key必须是小写的。(一直用PUPPETEER_DOWNLOAD_HOST,被坑了好久)

npm config set puppeteer_download_host=https://storage.googleapis.com.cnpmjs.org
@meathill

This comment has been minimized.

Copy link

commented Mar 15, 2018

@fwh1990 This works for me, under Windows 10 cmd.

@DiamondYuan

This comment has been minimized.

Copy link

commented Nov 26, 2018

现在要用 https://npm.taobao.org/mirrors 这个地址

@lyh2668

This comment has been minimized.

Copy link

commented Dec 25, 2018

还是这种方式适用性更好

@fengmk2

This comment has been minimized.

@vv314

This comment has been minimized.

Copy link

commented Jan 15, 2019

这么设置,亲测可用

npm config set puppeteer_download_host=https://npm.taobao.org/mirrors
@NicholasNC

This comment has been minimized.

Copy link

commented Mar 13, 2019

比较习惯用 yarn 安装(好像走错地方~)

一开始没有换源之前,安装不了,一直卡在:
image

更换源之后(yarn config set registry https://registry.npm.taobao.org),可以安装
不过命令行报了一些小提示(可以运行,不影响):
image

只是不甘心(有点洁癖),执行 yarn config set puppeteer_download_host=https://npm.taobao.org/mirrors后重新安装,不过结果还是同上

但是,直接用 cnpm 安装就没有问题,可能是因为我的是最新版?(6.0.0)

@NickeyLin

This comment has been minimized.

Copy link

commented Mar 25, 2019

@NicholasNC 你应该是写错了。 yarn 应该这样设置:
yarn config set puppeteer_download_host https://npm.taobao.org/mirrors。空格,不是等号。

@cnscorpions

This comment has been minimized.

Copy link

commented Mar 26, 2019

这么设置,亲测可用

npm config set puppeteer_download_host=https://npm.taobao.org/mirrors

换了源之后,yarn安装就可以了

@liudonghua123

This comment has been minimized.

Copy link

commented May 9, 2019

npm config set puppeteer_download_host=https://npm.taobao.org/mirrors works like a charm :haha
More details, see https://github.com/GoogleChrome/puppeteer/blob/master/install.js#L36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.