国外的npm registry由于受到墙的影响,所以很不稳定。
那么这种情况下怎么安装比较快呢?
首先得选好国内的源:
- 淘宝源:registry.npm.taobao.org
- cnpm源:registry.cnpmjs.org
第二,指定安装源:
npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/mirrors/node \
--userconfig=$HOME/.cnpmrc
npm获取配置最高优先级的方式是:
npm install --proxy http://username:password@server:port
次一级的方式是环境变量:
npm_config_proxy=http://server:port
所以:
HTTPS_PROXY=http://user:password@1.2.3.4:5678 meteor update
或者
npm_config_proxy=http://user:password@1.2.3.4:5678 meteor update
都是可行的