javascript - 主机名/IP 与证书的替代名称不匹配
问题描述
我正在开发一个 react native 项目,任何尝试安装包的尝试都npm
失败,并出现以下错误。
fitz:tesseractOcrSample fitzmode$ npm i
npm ERR! request to https://registry.npmjs.org/react failed, reason: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/fitzmode/.npm/_logs/2018-09-01T13_08_53_778Z-debug.log
查看其他解决方案,我尝试将其设置为strict-ssl
无济于事。false
npm config
我也尝试过使用yarn
,但得到以下。
fitz:tesseractOcrSample fitzmode$ yarn install
yarn install v1.7.0
info No lockfile found.
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443".
info If you think this is a bug, please open a bug report with the information provided in "/Users/fitzmode/Downloads/react-native-tesseract-ocr-master/tesseractOcrSample/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
我不确定它是我网络上的错误配置还是其他原因。有什么解决办法吗?
解决方案
这对我有用
我已经编辑了我的 /etc/hosts 文件并创建了一个这样的条目
104.16.109.30 registry.npmjs.org
它有效。
推荐阅读
- arrays - 使用隐藏输入将 VUE-Array 提交给 Laravel
- javascript - 检查表单输入是否为空,如果不是,则在按下提交按钮时显示隐藏的 div
- php - 表单提交中的PHP验证系统
- javascript - 如何在具有打字稿的样式组件中使用 backgroundImage css
- python-3.x - 通过 python3 pip 在 linux 上运行 tensorflow
- c# - C# 覆盖泛型类中的基类属性
- javascript - 在一个 div 中加载数据并清除另一个 div?
- ios - UICollectionViewCompositionalLayout 的背景视图在哪个方法中出列
- sql - PostgreSQL:查询的动态 WHERE 条件
- python - 无法存储 numpy.ndarray' 对象没有属性 'save'