https://github.com/GoogleChrome/puppeteer/issues/1597
使用国内Chromium源
https://npm.taobao.org/mirrors
# // > https://npm.taobao.org/mirrors
# // export PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors
# // set PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors
npm config set puppeteer_download_host=https://npm.taobao.org/mirrors
npm i puppeteer
或者用淘宝的cnpm 安装,自动使用国内源
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm i puppeteer
还可以手动下载Chromium文件,解压后放在本地
https://npm.taobao.org/mirrors/chromium-browser-snapshots/
- 放在模块的默认读取目录下
例如node_modules\puppeteer\.local-chromium\win64-526987(系统类型-版本号)\chrome-win32(下载的文件名)\
版本号来自 puppeteer/package.json->puppeteer.chromium_revision,具体见lib/Downloader.js - 放在其他目录,运行时设置路径参数
puppeteer.launch({executablePath:'ChromiumExePath'})
cnpm/cnpmjs.org#1246
storage.googleapis.com
整站代理:https://storage.googleapis.com.cnpmjs.org
https://npm.taobao.org/mirrors
cnpm/binary-mirror-config/package.json