为中国内地的Node.js开发者准备的镜像配置,大大提高node模块安装速度。
npm i -g mirror-config-china --registry=https://registry.npmmirror.com
# 查看npm配置
npm config list
# 查看环境变量
source ~/.bashrc && env
--registry=https://registry.npmmirror.com
registry.npmjs.com 镜像URL
--bin-mirrors-prefix=https://cdn.npmmirror.com/binaries
npmmirror.com/mirrors 镜像URL,会覆盖下文中的{bin-mirrors}
--nodejs-org-mirror={bin-mirrors}/node
(别名: --disturl
)nodejs.org/dist 镜像URL
--iojs-org-mirror={bin-mirrors}/iojs
iojs.org/dist 镜像URL
--nvmw-npm-mirror={bin-mirrors}/npm
github.com/npm/npm/releases 镜像URL
其他参数将被写入.npmrc
文件中
cd ~/my-project
mirror-config-china --registry=https://registry.npmmirror.com