尝试通过以下方式安装puppeteer时:npm i puppeteer
出现此错误。我的节点版本是v12.16.3。我在Windows机器上。
<!-- language: lang-none -->
ERROR: Failed to set up Chromium r756035! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
Error: Client network socket disconnected before secure TLS connection was established
at connResetException (internal/errors.js:608:14)
at TLSSocket.onConnectEnd (_tls_wrap.js:1514:19)
at Object.onceWrapper (events.js:416:28)
at TLSSocket.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
-- ASYNC --
at BrowserFetcher.<anonymous> (C:\Users\Red Viper\AppData\Roaming\npm\node_modules\puppeteer\lib\helper.js:116:19)
at fetchBinary (C:\Users\Red Viper\AppData\Roaming\npm\node_modules\puppeteer\install.js:148:8)
at download (C:\Users\Red Viper\AppData\Roaming\npm\node_modules\puppeteer\install.js:54:9) {
code: 'ECONNRESET',
path: null,
host: 'storage.googleapis.com',
port: 443,
localAddress: undefined
}
答案 0 :(得分:0)
答案 1 :(得分:0)
使用--unsafe-perm
对我有用!
npm i puppeteer -g --unsafe-perm
答案 2 :(得分:0)
对我来说,原因是这个地址在我的国家被禁止。我不得不使用代理来避免这个错误。
答案 3 :(得分:0)
从终端运行以下命令:
苹果机:
export PUPPETEER_SKIP_DOWNLOAD='true'
视窗:
SET PUPPETEER_SKIP_DOWNLOAD='true'
两者都会设置环境变量,你应该可以执行