为什么在安装angular cli时出现此错误?

时间:2018-09-01 15:31:51

标签: npm installation angular-cli

我输入了以下几行:

C:\Users\Surendra>node -v
v8.11.4

C:\Users\Surendra>npm -v
5.6.0

C:\Users\Surendra>npm install -g @angular/cli

我收到以下错误:

npm ERR! request to https://registry.npmjs.org/@angular%2fcli 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!     C:\Users\Surendra\AppData\Roaming\npm-cache\_logs\2018-09-01T15_14_45_954Z-debug.log

1 个答案:

答案 0 :(得分:0)

run npm cache clean --forcenpm install npm -g

然后尝试运行npm config set strict-ssl false

如果不起作用,请尝试运行npm config set registry "http://registry.npmjs.org"

编辑:

  

先前发生的涉及DNS错误配置的中断已导致某些ISP将npmjs.com缓存为丢失,一种解决方法是使用第三方DNS提供程序(例如Cloudflare或Google),受影响的缓存应在接下来的24小时内清除

https://status.npmjs.org/incidents/v22ffls5cd6h