新電腦,安裝環境,下載東西失敗:
$ npm install
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://www.npmjs.com/@sindresorhus%2fis failed, reason: self signed certificate in certificate chain
所以百度一波,感覺我配置的地址有問題,就取消重新配置了下
取消代理:
npm config delete proxy
npm config delete https-proxy
配置http代理:
npm config set proxy=http://代理地址:端口號
npm config set registry=http://registry.npmjs.org
關於https
經過上面設置使用了http開頭的源,因此不需要設https_proxy了,否則還要增加一句
:npm config set https-proxy http://代理地址:端口號
代理用戶名和密碼,(這個我沒使用,就可以下載東西了)
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port