首页 > 解决方案 > 尝试安装 aws-azure-login 时出现 Chromium 错误

问题描述

当我尝试在 Windows 10 上使用以下命令 npm install -g aws-azure-login 安装 aws-azure-login 时,我收到以下错误...

npm WARN deprecated cheerio-select-tmp@0.1.1: Use cheerio-select instead
npm ERR! code 1
npm ERR! path C:\Users\BUCS002\AppData\Roaming\npm\node_modules\aws-azure-login\node_modules\puppeteer
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm ERR! ERROR: Failed to set up Chromium r818858! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
npm ERR! Error: self signed certificate in certificate chain
npm ERR!     at TLSSocket.onConnectSecure (node:_tls_wrap:1531:34)
npm ERR!     at TLSSocket.emit (node:events:378:20)
npm ERR!     at TLSSocket._finishInit (node:_tls_wrap:945:8)
npm ERR!     at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:719:12) {
npm ERR!   code: 'SELF_SIGNED_CERT_IN_CHAIN'
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\BUCS002\AppData\Local\npm-cache\_logs\2021-03-31T21_18_10_823Z-debug.log

我还在日志中获得了这些附加信息......

922 verbose stack Error: command failed
922 verbose stack     at ChildProcess.<anonymous> (C:\Users\BUCS002\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
922 verbose stack     at ChildProcess.emit (node:events:378:20)
922 verbose stack     at maybeClose (node:internal/child_process:1067:16)
922 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
923 verbose pkgid puppeteer@5.5.0
924 verbose cwd C:\Program Files\Cmder
925 verbose Windows_NT 10.0.18363
926 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\BUCS002\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "aws-azure-login"
927 verbose node v15.11.0
928 verbose npm  v7.7.6

有什么想法可以解决这个问题吗?

标签: windowsamazon-web-servicesazurenpm-install

解决方案


引擎盖下aws-azure-login正在使用puppeteer,它依赖于chromium,为了能够使用它,你必须先安装它,比如

node C:\Users\user.name\AppData\Roaming\npm\node_modules\aws-azure-login\node_modules\puppeteer\install.js

替换路径中的用户名,该命令将在此处安装所需的 Chromium 版本

C:\Users\user.name\AppData\Roaming\npm\node_modules\aws-azure-login\node_modules\puppeteer\.local-chromium\

推荐阅读