I'm trying to install the MERN stack on my Mac, however, when I run the following command:
sudo npm install -g mern-cli
I get this error message:
request to https://registry.npmjs.org/mern-cli 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"
I tried several things, like running the following command (which solved the problem for others):
sudo npm config set registry https://registry.npmjs.org/
However, this doesn't solve the problem. Also reinstalling Node completely didn't solve the problem. How to solve this?
EDIT: Full debug log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'mern-cli' ]
2 info using npm@5.6.0
3 info using node@v8.11.4
4 verbose npm-session f5dd10c6d19e4605
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for mern-cli@latest request to https://registry.npmjs.org/mern-cli 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"
8 verbose type system
9 verbose stack FetchError: request to https://registry.npmjs.org/mern-cli 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 stack at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
9 verbose stack at emitOne (events.js:116:13)
9 verbose stack at ClientRequest.emit (events.js:211:7)
9 verbose stack at TLSSocket.socketErrorListener (_http_client.js:387:9)
9 verbose stack at emitOne (events.js:116:13)
9 verbose stack at TLSSocket.emit (events.js:211:7)
9 verbose stack at emitErrorNT (internal/streams/destroy.js:64:8)
9 verbose stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
9 verbose stack at process._tickCallback (internal/process/next_tick.js:180:9)
10 verbose cwd /Users/Bjorn/Desktop/StoryOfAms
11 verbose Darwin 17.7.0
12 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "mern-cli"
13 verbose node v8.11.4
14 verbose npm v5.6.0
15 error request to https://registry.npmjs.org/mern-cli 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"
16 verbose exit [ 1, true ]