npm下载包失败

npm无法下载任何包,并且出现下面错误:

Miscellaneous Warning ERR_TLS_CERT_ALTNAME_INVALID: request to https://registry.cnpmjs.org/express failed, reason: Hostname/IP does not match certificate's altnames: Host: registry.cnpmjs.org. is not in the cert's altnames: DNS:r.cnpmjs.org
npm WARN registry Using stale data from http://registry.cnpmjs.org/ due to a request error during revalidation

解决办法: 直接在node窗口输入:

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

找了好久,都太麻烦,这个是最简单,亲测有效

你可能感兴趣的:(其他)