首页 前端知识 im_electron_sdk升级: Hostname/IP does not match certificate‘s altnames: Host: npm.taobao.org.

im_electron_sdk升级: Hostname/IP does not match certificate‘s altnames: Host: npm.taobao.org.

2024-05-23 20:05:54 前端知识 前端哥 32 685 我要收藏

一、问题描述

im_electron_sdk升级,由2.0.19升级至3.0.22版本,当运行yarn install时遇到如下错误:

RequestError: Hostname/IP does not match certificate's altnames: Host: npm.taobao.org. is not in the cert's altnames: DNS:*.tbcdn.cn, DNS:*.taobao.com, DNS:*.alicdn.com, DNS:*.cmos.greencompute.org, DNS:cmos.greencompute.org, DNS:m.intl.taobao.com, DNS:*.mobgslb.tbcache.com, DNS:*.alikunlun.com, DNS:alikunlun.com, DNS:*.django.t.taobao.com, DNS:alicdn.com, DNS:*.tbcache.com, DNS:*.tmall.com, DNS:*.1688.com, DNS:*.3c.tmall.com, DNS:*.alibaba.com, DNS:*.aliexpress.com, DNS:*.aliqin.tmall.com, DNS:*.alitrip.com, DNS:*.aliyun.com, DNS:*.cainiao.com, DNS:*.cainiao.com.cn, DNS:*.chi.taobao.com, DNS:*.chi.tmall.com, DNS:*.china.taobao.com, DNS:*.dingtalk.com, DNS:*.etao.com, DNS:*.feizhu.cn, DNS:*.feizhu.com, DNS:*.fliggy.com, DNS:*.fliggy.hk, DNS:*.food.tmall.com, DNS:*.jia.taobao.com, DNS:*.jia.tmall.com, DNS:*.ju.taobao.com, DNS:*.juhuasuan.com, DNS:*.lw.aliimg.com, DNS:*.m.1688.com, DNS:*.m.alibaba.com, DNS:*.m.alitrip.com, DNS:*.m.cainiao.com, DNS:*.m.etao.com, DNS:*.m.taobao.com, DNS:*.m.taopiaopiao.com, DNS:*.m.tmall.com, DNS:*.m.tmall.hk, DNS:*.mei.com, DNS:*.taopiaopiao.com, DNS:*.tmall.hk, DNS:*.trip.taobao.com, DNS:*.xiami.com, DNS:1688.com, DNS:alibaba.com, DNS:aliexpress.com, DNS:alitrip.com, DNS:aliyun.com, DNS:cainiao.com, DNS:cainiao.com.cn, DNS:dingtalk.com, DNS:etao.com, DNS:feizhu.cn, DNS:feizhu.com, DNS:fliggy.com, DNS:fliggy.hk, DNS:juhuasuan.com, DNS:mei.com, DNS:taobao.com, DNS:taopiaopiao.com, DNS:tmall.hk, DNS:xiami.com, DNS:tmall.com, DNS:*.cloudvideocdn.taobao.com, DNS:cloudvideocdn.taobao.com, DNS:tbcdn.cn
    at ClientRequest.<anonymous> (D:\workspace\mijian_desktop_dev-v2\node_modules\im_electron_sdk\node_modules\got\dist\source\core\index.js:970:111)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at origin.emit (D:\workspace\mijian_desktop_dev-v2\node_modules\im_electron_sdk\node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
    at TLSSocket.socketErrorListener (node:_http_client:502:9)

在这里插入图片描述

二、解决方案

按照报错提示进行搜索,会得到一下解决方式:

(1)设置镜像

npm config set registry https://registry.npmmirror.com
yarn config set registry https://registry.npmmirror.com 

(2)忽略 ssl 证书校验

npm config set strict-ssl false
yarn config set strict-ssl false

或者直接:

yarn install --registry=https://registry.npmmirror.com --strict-ssl=false

正常情况下应该可以解决这个问题,但对本机却无效。这里要使用yarn config list看一下yarn的配置信息:

在这里插入图片描述
注意到里面有一个关于electron的镜像配置项ELECTRON_MIRROR,那么尝试将其从配置中删除,运行以下命令:

yarn config delete ELECTRON_MIRROR

注意:ELECTRON_MIRROR大小写敏感,不要写成electron_mirror

在这里插入图片描述

删除成功后,再次运行yarn install,一切就正常了。

转载请注明出处或者链接地址:https://www.qianduange.cn//article/9201.html
评论
发布的文章

用JS生成本周日期代码

2024-04-18 17:04:15

js 递归函数

2024-05-31 10:05:46

jQuery是什么?如何使用?

2024-03-12 01:03:24

js延迟加载的六种方式

2024-05-30 10:05:51

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!