npm install异常:“registry.cnpmjs.org. is not in the altnames: DNS:r.cnpmjs.org”

5 篇文章 0 订阅
3 篇文章 0 订阅
reason: Hostname/IP does not match certificate's altnames: Host: registry.cnpmjs.org. is not in the cert's altnames: DNS:r.cnpmjs.org异常分析
一、今天更新了项目到最新版本后,需要更新一下依赖包,但是使用npm install --save redux的时候出现问题了
npm install --save redux
npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! errno ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! request to https://registry.cnpmjs.org/redux failed, reason: Hostname/IP does not match certificate's altnames: Host: registry.cnpmjs.org. is not in the cert's altnames: DNS:r.cnpmjs.org

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\80992399\AppData\Roaming\npm-cache\_logs\2020-06-08T06_53_10_364Z-debug.log
二、之前使用npm install都是更新成功的,初步判断是连接不到registry.npmjs.org,因为公司连接到外网需要经过代理的,之前是设置好代理的了,但是有可能代理失效了。
二、一开始以为是代理的问题,因为公司的网络需要设置代理才能连接到外网的,所以重新设置了代理,但是发现没有效果。需要设置代理的卡伊参考这篇文章:https://blog.csdn.net/jim_LoveQ/article/details/106383707
三、在度娘上看到有的说重新配置npm的registry就可以了:
npm config set registry http://registry.npmjs.org

更新了registry之后就可以了

npm install --save redux
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ redux@4.0.5
added 2 packages from 1 contributor and audited 1682 packages in 12.442s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
四、要是还不行可以这篇文章:NPM not installing package. Hostname/IP address doesn’t match certificate’s altnames:
五、总结:这次的Host: registry.cnpmjs.org. is not in the cert's altnames: DNS:r.cnpmjs.org'就到这里结束了,如果有疑问可以直接留言评论,如果觉得对你有帮助,可以小小的赞赏一杯奶茶钱,谢谢!!

在这里插入图片描述

  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值