设置国内registry,加快下载速度
-
在命令行先查看
npm config get registry -
临时设置访问源,命令行输入:
npm config set registry https://registry.npm.taobao.org/) -
命令行中直接加registry参数。
npm --registry=https://registry.npm.taobao.org install express -
若想永久设置,编辑 ~/.npmrc文件,输入:
vi ~/.npmrc registy=https://registry.npm.taobao.org/ -
修改本地或者tb镜像(搭建私服教程)
淘宝镜像npm config set registry http://registry.npm.taobao.org/或
官方镜像npm config set registry https://registry.npmjs.org/或
个人镜像npm config set registry http://198.216.15.203:8081/repository/npm-all/(这里地址自行改成自己配置的地址)
- 验证配置镜像
npm -loglevel info install grunt