Hostname/IP doesn't match certificate's altnames

Viewed 3389

I'm working on a react native project and any attempt to install packages from npm fails with the error below.

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

Looking at other solutions I have tried to set the strict-ssl to false in the npm config to no avail.

I have also tried using yarn instead but get the below.

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.

I'm not sure if its a mis-configuration on my network or something else. Any solutions?

3 Answers

This works for me

I have edited my /etc/hosts file and create an entry like this

104.16.109.30   registry.npmjs.org

and it works.

SOLVED

I changed the DNS provider on my machine to OpenDNS. Apparently there may have been a misconfiguration on the npm registry that may be cached by my ISP.

In Preferences > Network > Advanced > DNS (Tab) , I've added 208.67.222.222 and 208.67.220.220 to the list of DNS servers.

More info here here

This works for me

Add

104.16.16.35    registry.yarnpkg.com

to /etc/hosts

Related