npm使用國內鏡像源

[toc]git

1、經過配置 npm

  • 經過 config 設置
npm config set registry https://registry.npm.taobao.org

# 驗證指令
npm config get registry
  • 命令行指定
npm --registry https://registry.npm.taobao.org
  • 編輯配置文件 ~/.npmrc 加入下面內容
registry = https://registry.npm.taobao.org

2、經過使用 cnpm

# 安裝 cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org

# 使用 cnpm 
cnpm install xxx

3、相關資料

淘寶 NPM 鏡像 : https://npm.taobao.org/
創建或使用鏡像,參考: https://github.com/cnpm/cnpmjs.orggithub

相關文章
相關標籤/搜索