在我的公司,有一个自动签名的ssl证书。因此,他们是一些npm软件包,因为它不能安装。
我已经在.npmrc
或--strict-ssl=false
命令args中添加了--strict-ssl=false
。
它适用于某些软件包,但有些包似乎不负责此选项。
举个例子,我试图安装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
似乎只有使用postinstall
的包才会出现问题。
最明智的做法是更改SSL证书,但不幸的是无法做到。
那么,您知道在npm安装后是否有绕过证书验证的替代方案吗?
提前谢谢你的提议。
发布于 2021-07-02 12:59:05
对我来说,下面的解决方案奏效了。
OS - windows 10 终端git bash
在安装柏树之前运行这些命令。
setx HTTP_PROXY <your company proxy url>
setx NODE_EXTRA_CA_CERTS <path to cerm.pem file>
这些变量将被设置为系统中的环境变量,以供将来使用。如果你不需要的话,你随时都可以摆脱它们。
https://stackoverflow.com/questions/57158587
复制相似问题