为npm设置代理
在微信小程序云函数中使用部署时报错
错误:
npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! errno ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! request to https://registry.cnpmjs.org/wx-server-sdk failed, reason: Hostname/IP does not match certificate's altnames: Host: registry.cnpmjs.org. is not in the cert's altnames: DNS:r.cnpmjs.orgnpm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\v_xccxmo\AppData\Roaming\npm-cache\_logs\2020-10-22T02_41_10_399Z-debug.log
解决:
1.1 为npm设置代理
ip和端口改成自己的代理数据
npm config set proxy http://127.0.0.1:12639
npm config set https-proxy http://127.0.0.1:12639
2. 修改npm存放package的网站地址
npm config set registry "http://registry.npmjs.org/"
参考:https://blog.****.net/qq_34645412/article/details/74784408