Mar*_*ine 3 ssl npm npm-install cypress
在我的公司,有一个自动签名的 ssl 证书。所以它们是一些因此无法安装的 npm 包。
我已经添加strict-ssl=false在.npmrc或--strict-ssl=false命令ARGS。
它适用于某些软件包,但有些似乎不负责此选项。
例如,我尝试安装Cypress:
命令 :
npm i cypress --save-dev --strict-ssl=false
错误日志:
> cypress@3.4.0 postinstall /Users/mchoraine/Documents/Workplace/SAMSE/rechercheproduit/rechercheproduit-front/node_modules/cypress
> node index.js --exec install
Installing Cypress (version: 3.4.0)
? Downloading Cypress
? Cypress Version: 3.4.0
Unzipping Cypress
Finishing Installation
The Cypress App could not be downloaded.
Please check network connectivity and try again:
----------
URL: https://download.cypress.io/desktop/3.4.0?platform=darwin&arch=x64
Error: self signed certificate in certificate chain
----------
Platform: darwin (18.6.0)
Cypress Version: 3.4.0
Run Code Online (Sandbox Code Playgroud)
问题似乎只发生在带有 postinstall
最明智的做法是更改 SSL 证书,但不幸的是它无法完成。
那么您知道在 npm postinstall 上绕过证书验证的替代方法吗?
预先感谢您的建议。
获取您公司证书的副本,然后在运行 npm 命令之前将 NODE_EXTRA_CA_CERTS 环境变量设置为指向它:
export NODE_EXTRA_CA_CERTS=path/to/certificate.crt
Run Code Online (Sandbox Code Playgroud)
安装后脚本是一个单独的节点程序,因此 npm 标志不会影响它。
归功于在相关 GitHub 问题上发布此解决方案的“zerdos”:https : //github.com/cypress-io/cypress/issues/1401#issuecomment-393591520
| 归档时间: |
|
| 查看次数: |
4909 次 |
| 最近记录: |