npm设置淘宝镜像源

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

  1. npm 临时使用
    # 以 events 依赖包为例
    npm --registry https://registry.npmmirror.com install events --save
    
  2. npm 持久使用
    npm config set registry https://registry.npmmirror.com
    
    # 验证:通过以下方式验证结果
    npm config get registry
    
    # 使用:以 events 依赖包为例
    npm install events --save
    
  3. cnpm 使用
    npm install -g cnpm --registry=https://registry.npmmirror.com
    
    # 使用:以 events 依赖包为例
    cnpm install events --save
    

还原 npm 仓库地址:

npm config set registry https://registry.npmjs.org/
posted @ 2022-03-24 21:51  太轻描淡写了  阅读(6497)  评论(0编辑  收藏  举报