npm切换下载url(nrm切换镜像源)

    • 1镜像使用方法
      • 1通过config命令
      • 2命令行指定
      • 3编辑 npmrc 加入下面内容
    • 2nrm切换镜像方法
      • 1查看当前使用镜像registry

1、镜像使用方法

(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):

1)通过config命令

npm config set registry http://registry.cnpmjs.org
npm info underscore (如果上面配置正确这个命令会有字符串response)

2)命令行指定

npm --registry http://registry.cnpmjs.org info underscore

3)编辑 ~/.npmrc 加入下面内容

registry = http://registry.cnpmjs.org

2、nrm切换镜像方法

nrm是一个npm registry 管理工具 ,nrm能够查看和切换当前使用的registry。最常用的还是切换成淘宝镜像服务器使用方法

1)查看当前使用镜像registry

npm install -g nrm //安装nrm
nrm ls //查看registry

npm切换下载url(nrm切换镜像源)_第1张图片

2)切换镜像源

nrm use taobao //切换淘宝镜像

npm切换下载url(nrm切换镜像源)_第2张图片

你可能感兴趣的:(工具,js,问题)