Ssl NPM安装错误:证书链中的自签名证书

Ssl NPM安装错误:证书链中的自签名证书,ssl,npm,npm-install,cypress,Ssl,Npm,Npm Install,Cypress,在我的公司,有一个自动签名的ssl证书。因此,它们是一些无法安装的npm软件包 我已经在.npmrc或--strict ssl=false命令参数中添加了strict ssl=false 它适用于某些软件包,但有些软件包似乎并不负责此选项 例如,我尝试安装Cypress: 命令: > cypress@3.4.0 postinstall /Users/mchoraine/Documents/Workplace/SAMSE/rechercheproduit/rechercheproduit-f

在我的公司,有一个自动签名的ssl证书。因此,它们是一些无法安装的npm软件包

我已经在
.npmrc
--strict ssl=false
命令参数中添加了
strict ssl=false

它适用于某些软件包,但有些软件包似乎并不负责此选项

例如,我尝试安装Cypress:

命令:

> 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
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 postinstall上绕过证书验证的替代方案


提前感谢你的建议

获取公司证书的副本,然后在运行npm命令之前,将NODE_EXTRA_CA_CERTS环境变量设置为指向它:

export NODE_EXTRA_CA_CERTS=path/to/certificate.crt
安装后脚本是一个单独的节点程序,因此npm标志不会影响它


值得赞扬的是“zerdos”,他在一个相关的GitHub问题上发布了这个解决方案:

我在
PhantomJS上得到了同样的问题