npm ci报错

文章讲述了在尝试安装Node.js库puppeteer时遇到的错误,主要是由于下载Chromium失败。解决方法是设置环境变量PUPPETEER_SKIP_CHROMIUM_DOWNLOAD为true,适用于Mac系统用户。
摘要由CSDN通过智能技术生成

npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/ziren/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated @types/jest-diff@24.3.0: This is a stub types definition. jest-diff provides its own type definitions, so you do not need this installed.
npm ERR! npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm ERR! npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm ERR! npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm ERR! npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm ERR! npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm ERR! npm WARN deprecated rollup-plugin-babel@4.3.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm ERR! npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /Users/ziren/.npm/_cacache/tmp/git-cloneRuUVcP/node_modules/puppeteer
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c -- node install.js
npm ERR! npm ERR! ERROR: Failed to download Chromium r662092! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
npm ERR! npm ERR! Error: read ECONNRESET
npm ERR! npm ERR!     at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
npm ERR! npm ERR!   -- ASYNC --
npm ERR! npm ERR!     at BrowserFetcher.<anonymous> (/Users/ziren/.npm/_cacache/tmp/git-cloneRuUVcP/node_modules/puppeteer/lib/helper.js:110:27)
npm ERR! npm ERR!     at Object.<anonymous> (/Users/ziren/.npm/_cacache/tmp/git-cloneRuUVcP/node_modules/puppeteer/install.js:64:16)
npm ERR! npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1159:14)
npm ERR! npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
npm ERR! npm ERR!     at Module.load (node:internal/modules/cjs/loader:1037:32)
npm ERR! npm ERR!     at Module._load (node:internal/modules/cjs/loader:878:12)
npm ERR! npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR! npm ERR!     at node:internal/main/run_main_module:23:47 {
npm ERR! npm ERR!   errno: -54,
npm ERR! npm ERR!   code: 'ECONNRESET',
npm ERR! npm ERR!   syscall: 'read'
npm ERR! npm ERR! }
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/ziren/.npm/_logs/2024-01-03T05_59_33_321Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ziren/.npm/_logs/2024-01-03T05_55_57_101Z-debug-0.log

原因:安装 puppeteer失败,安装过程会下载Chromium。国内下载Chromium肯定失败的

根据提示,设置环境变量后正常

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

Mac系统

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值