npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

registry.npmjs.org ssl certificate error

it is working again, at least in my case. Sometimes waiting really helps :grinning:


Nope it is not working…

npm ERR!     /home/rampage/.npm/_logs/2018-09-01T10_55_15_833Z-debug.log
rampage@rampage-ThinkStation-D20:~/Desktop/work/repos/private/@rxdi/graphql$ npm i
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning undefined: request to https://registry.npmjs.org/@rxdi%2fcore 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 WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN @gapi/playground@1.0.11 requires a peer of @rxdi/core@^0.0.146 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest@22.4.6 requires a peer of typescript@2.x but none is installed. You must install peer dependencies yourself.
npm WARN tslint-language-service@0.9.9 requires a peer of typescript@>= 2.3.1 < 3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/rampage/Desktop/work/repos/private/@rxdi/graphql/node_modules/.staging/fsevents-1422a892/node_modules/abbrev' -> '/home/rampage/Desktop/work/repos/private/@rxdi/graphql/node_modules/.staging/abbrev-2a37932e'

npm ERR! request to https://registry.npmjs.org/@rxdi/hapi/-/hapi-0.0.228.tgz 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!     /home/rampage/.npm/_logs/2018-09-01T11_01_42_614Z-debug.log
rampage@rampage-ThinkStation-D20:~/Desktop/work/repos/private/@rxdi/graphql$ npm i -g npm
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning undefined: request to https://registry.npmjs.org/npm 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 WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
/home/rampage/.nvm/versions/node/v8.9.4/bin/npm -> /home/rampage/.nvm/versions/node/v8.9.4/lib/node_modules/npm/bin/npm-cli.js
/home/rampage/.nvm/versions/node/v8.9.4/bin/npx -> /home/rampage/.nvm/versions/node/v8.9.4/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.2.0
updated 1 package in 6.392s
rampage@rampage-ThinkStation-D20:~/Desktop/work/repos/private/@rxdi/graphql$ npm i
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning undefined: request to https://registry.npmjs.org/@rxdi%2fhapi 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 WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN @gapi/playground@1.0.11 requires a peer of @rxdi/core@^0.0.146 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest@22.4.6 requires a peer of typescript@2.x but none is installed. You must install peer dependencies yourself.
npm WARN tslint-language-service@0.9.9 requires a peer of typescript@>= 2.3.1 < 3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/rampage/Desktop/work/repos/private/@rxdi/graphql/node_modules/.staging/fsevents-1422a892/node_modules/abbrev' -> '/home/rampage/Desktop/work/repos/private/@rxdi/graphql/node_modules/.staging/abbrev-2a37932e'

npm ERR! request to https://registry.npmjs.org/@rxdi/hapi/-/hapi-0.0.228.tgz 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!     /home/rampage/.npm/_logs/2018-09-01T11_03_14_172Z-debug.log
rampage@rampage-ThinkStation-D20:~/Desktop/work/repos/private/@rxdi/graphql$


I’ve just rerun the command @byCedric and it went thru, looks like the problem is resolved. Can you confirm?


now registry.npmjs.org returns 500:

error An unexpected error occurred: “http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz: Request failed “500 Internal Server Error””.


Going to registry.npmjs.org reveals the issue.

Fastly error: unknown domain. Please check that this domain has been added to a service.


It didn’t change anything. Was even “null” before.


same error :
0 info it worked if it ends with ok 1 verbose cli [ '/home/practicewild/.nvm/versions/node/v8.11.4/bin/node', 1 verbose cli '/home/practicewild/.nvm/versions/node/v8.11.4/bin/npm', 1 verbose cli 'install', 1 verbose cli 'npm' ] 2 info using npm@5.6.0 3 info using node@v8.11.4 4 verbose config Skipping project config: /home/practicewild/.npmrc. (matches userconfig) 5 verbose npm-session d0aee4ea6e1d535a 6 silly install loadCurrentTree 7 silly install readLocalPackageData 8 silly fetchPackageMetaData error for npm@latest request to https://registry.npmjs.org/npm 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" 9 verbose type system 10 verbose stack FetchError: request to https://registry.npmjs.org/npm 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" 10 verbose stack at ClientRequest.req.on.err (/home/practicewild/.nvm/versions/node/v8.11.4/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14) 10 verbose stack at emitOne (events.js:116:13) 10 verbose stack at ClientRequest.emit (events.js:211:7) 10 verbose stack at TLSSocket.socketErrorListener (_http_client.js:387:9) 10 verbose stack at emitOne (events.js:116:13) 10 verbose stack at TLSSocket.emit (events.js:211:7) 10 verbose stack at emitErrorNT (internal/streams/destroy.js:64:8) 10 verbose stack at _combinedTickCallback (internal/process/next_tick.js:138:11) 10 verbose stack at process._tickCallback (internal/process/next_tick.js:180:9) 11 verbose cwd /home/practicewild 12 verbose Linux 4.15.0-33-generic 13 verbose argv "/home/practicewild/.nvm/versions/node/v8.11.4/bin/node" "/home/practicewild/.nvm/versions/node/v8.11.4/bin/npm" "install" "npm" 14 verbose node v8.11.4 15 verbose npm v5.6.0 16 error request to https://registry.npmjs.org/npm 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" 17 verbose exit [ 1, true ]


See my post here. I’ve resolved the issue on my machine.


Unfortunately not, also when wiping the DNS cache it still responds with that error. One thing I find weird is when accessing the page with Chrome it previously states the certificate issue too. That doesn’t happen anymore, it only triggers in CLI.


Huh. I just got that error too, but after spamming npm i a couple times I got it to download some packages.


This was due to an incident and should be resolved now. Please see https://status.npmjs.org/incidents/v22ffls5cd6h for more details!


I confirm having the same problem when runnning npm install and npm audit fix. The error that I receive is:
$ sudo npm i -g npm@latest
npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! errno ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! request to https://registry.npmjs.org/npm failed, reason: Hostname/IP does not 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


How is it there’s no official statement and no official workaround?

Btw npm config set strict-ssl false also doesn’t help. Install then just hangs:

$ npm config set strict-ssl true
$ npm install web3 --save
[..................] / rollbackFailedOptional: verb npm-session xxxxxx


I don’t think it’s a viable workaround:

dig registry.yarnpkg.org @1.1.1.1 -> NXDOMAIN

https://github.com/yarnpkg/yarn/issues/5891 - registry.yarnpkg.com seems to be deprecated.


The temporary fix doesn’t work if the error is happening on a CI server and you don’t have access to the hosts file. Is my only option just to wait till the DNS fixes propagate?


Here what it says when i try to login

https://registry.npmjs.org/-/v1/login

npm verb web login before first POST
npm http request → POST https://registry.npmjs.org/-/v1/login
npm http 500 ← Internal Server Error (https://registry.npmjs.org/-/v1/login)
npm verb web login not supported, trying couch
Username:


full message is:

error An unexpected error occurred: "https://registry.npmjs.org/address/-/address-1.0.3.tgz: 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\””.

this issue is not 100% reproducible on my side.
I guess is there a something wrong with fastly CDN?

related posts:

https://github.com/npm/npm/issues/13490


https://www.sslshopper.com/ssl-checker.html#hostname=https://registry.npmjs.org/

None of the common names in the certificate match the name that was entered (registry.npmjs.org). You may receive an error when accessing this site in a web browser.


Having the same issue from today.

Before 6 hours i was not having this problem.

Also now the npm registry is down and i cannot install any package!


You can temporarily set your registry to registry.yarnpkg.com if you badly need to install some packages

npm config set registry https://registry.yarnpkg.com/

Just remember to change it back after.

npm config set registry https://registry.npmjs.org/

Certain packages may fail to install under Yarn’s registry since some dependencies are only available on NPM.


Guess the only thing we can do now is wait.


That’s why I said temporarily. But you are correct. registry.yarnpkg.com is being deprecated.


I can confirm I have the exact same error as @anis-marrouchi. I’m using Google’s Public DNS service and I’m located in Amsterdam (maybe that can help in reproducing the issue).

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/10.9.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'npm@latest' ]
2 info using npm@6.4.1
3 info using node@v10.9.0
4 verbose npm-session abb1a104e5601559
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for npm@latest request to https://registry.npmjs.org/npm failed, reason: Hostname/IP does not 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
8 timing stage:rollbackFailedOptional Completed in 2ms
9 timing stage:runTopLevelLifecycles Completed in 1273ms
10 verbose type system
11 verbose stack FetchError: request to https://registry.npmjs.org/npm failed, reason: Hostname/IP does not 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
11 verbose stack     at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
11 verbose stack     at ClientRequest.emit (events.js:182:13)
11 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:391:9)
11 verbose stack     at TLSSocket.emit (events.js:182:13)
11 verbose stack     at emitErrorNT (internal/streams/destroy.js:82:8)
11 verbose stack     at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
11 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
12 verbose cwd /Users/cedric/Projects/bycedric/semantic-release-expo
13 verbose Darwin 17.7.0
14 verbose argv "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/bin/npm" "install" "-g" "npm@latest"
15 verbose node v10.9.0
16 verbose npm  v6.4.1
17 error code ERR_TLS_CERT_ALTNAME_INVALID
18 error errno ERR_TLS_CERT_ALTNAME_INVALID
19 error request to https://registry.npmjs.org/npm failed, reason: Hostname/IP does not 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
20 verbose exit [ 1, true ]


this might helps:

npm config set ca ""

from https://stackoverflow.com/questions/9626990/receiving-error-error-ssl-error-self-signed-cert-in-chain-while-using-npm


Use your hosts file and add the following as a temporary fix (from @crookse post )


What’s more - the certificate issue is not even visible on https://status.npmjs.org/. They had this DNS issue, but the one we face is completly different i guess.


I’m still having the issue :frowning:


https://registry.yarnpkg.com/ Host not found :roll_eyes: