Error系列-unexpected error occurred self signed certificate in certificate chain
执行yarn install 或者 其他命令遇到这个报错: error An unexpected error occurred: "https://XXX/XXX self signed certificate in certificate chain".
XXX cloud-service-catalog % yarn install
yarn install v1.22.18
info No lockfile found.
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error An unexpected error occurred: "https://XXX: self signed certificate in certificate chain".
info If you think this is a bug, please open a bug report with the information provided in "/Users/XXX/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
分析
- SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整性的一种安全协议。TLS与SSL在传输层对网络连接进行加密。
- npm install,yarn install 默认https协议,需要通过数字证书来保证安全
解决方案,执行下面命令即可
如果你使用的是npm
我们通过执行下面代码来取消npm的https认证,
npm set strict-ssl false
如果你使用的是yarn
yarn config set "strict-ssl" false -g
接下来可以按照之前流程正常操作啦~
小伙伴们,先写到这里啦,我们明天再见啦~~
大家要天天开心哦
欢迎大家指出文章需要改正之处~
学无止境,合作共赢