npm太慢, 淘宝npm镜像使用方法

淘宝npm地址: http://npm.taobao.org/

1.临时使用

npm --registry https://registry.npm.taobao.org install express

2.持久使用

npm config set registry https://registry.npm.taobao.org
  • 配置后可通过下面方式来验证是否成功
    npm config get registry
  • 或
    npm info express

3.通过cnpm使用

npm install -g cnpm --registry=https://registry.npm.taobao.org
  • 使用
    cnpm install express

4、npm修改或切换镜像地址

  • 方法一:直接编辑npm配置文件
    npm config edit
    1416090-20180621111355013-1113191392.png

直接修改registry的地址:
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/
registry=https://registry.npm.taobao.org

  • 方法二:用代码更改npm的配置文件
    npm config set registry http://registry.npm.taobao.org

  • 方法三:使用nrm管理registry地址

    • 安装nrm
      npm i -g nrm

    • 查看镜像列表
      nrm ls

      查看镜像

    • 切换镜像
      nrm use taobao

    • 在nrm添加自己的镜像地址
      nrm add r_name r_url

    • 删除
      nrm del r_name

    • 测试镜像的相应速度
      nrm test r_name

原文地址

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容