unable to verify the first certificate 原因及解决方法
# 背景
此前,在项目中安装依赖时,遇到了如下报错:
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz: unable to verify the first certificate".
info If you think this is a bug, please open a bug report with the information provided in "D:\\MyWork\\FAIRsFAIR\\fairificator\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
1
2
3
4
5
2
3
4
5
报错信息为:unable to verify the first certificate
,与证书有关。由于 yarn install 或 npm install 走的是 HTTPS 协议,它的安全通过数字证书来保障。数字证书由专门机构颁发,通常是付费的。自签证书,就是自己扮演数字证书机构给自己颁发的证书。
# 解决方法
在确定「安全」的情况下,可以临时关闭 strict-ssl 选项:
$ yarn config set strict-ssl false
$ npm config set strict-ssl false
1
2
2
上次更新: 2024/01/30, 00:35:17
- 01
- Node与GLIBC_2.27不兼容解决方案08-19
- 02
- Git清空本地文件跟踪缓存08-13