1, 修改 下载仓库为淘宝镜像
npm config set registry http://registry.npm.taobao.org/
参考: https://www.cnblogs.com/onew/p/11330439.html
单次依赖 使用淘宝镜像
npm install --registry=https://registry.npm.taobao.org
2, 如果要发布自己的镜像需要修改回来
npm config set registry https://registry.npmjs.org/
3, 安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
设置代理
npm config set proxy=http://127.0.0.1:8087
关于https
经过上面设置使用了http开头的源,因此不需要设https_proxy了,否则还要增加一句:
npm config set https-proxy http://server:port
代理用户名和密码
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port
取消设置代理
npm config delete proxy
npm config delete https-proxy
参考:https://blog.csdn.net/u014225733/article/details/88225855
参考二:https://blog.csdn.net/jiangkai528/article/details/45502067