npm.taobao.org淘宝 NPM 镜像,registry.npm.taobao.org 是从 r.cnpmjs.org 进行全量同步的,同步频率10分钟。

  • 开源镜像: http://npm.taobao.org/mirrors
  • Node.js 镜像: http://npm.taobao.org/mirrors/node
  • alinode 镜像: http://npm.taobao.org/mirrors/alinode
  • phantomjs 镜像: http://npm.taobao.org/mirrors/phantomjs
  • ChromeDriver 镜像: http://npm.taobao.org/mirrors/chromedriver
  • OperaDriver 镜像: http://npm.taobao.org/mirrors/operadriver
  • Selenium 镜像: http://npm.taobao.org/mirrors/selenium
  • Node.js 文档镜像: http://npm.taobao.org/mirrors/node/latest/docs/api/index.html
  • NPM 镜像: https://npm.taobao.org/mirrors/npm/
  • electron 镜像: https://npm.taobao.org/mirrors/electron/
  • node-inspector 镜像: https://npm.taobao.org/mirrors/node-inspector/

命令

  • yarn add -D node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
  • npm install -D node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
  • npm install -g cnpm --registry=https://registry.npm.taobao.org
  • npm config set proxy http://127.0.0.1:52081
  • npm config delete proxy下载完成后删除http代理

配置文件

可参考:https://juejin.cn/post/6844903641141215239

镜像源设置权重:命令行 > 项目.npmrc > 全局.npmrc > 默认镜像源

  • .npmrc
1
2
3
4
5
6
7
registry=https://registry.npm.taobao.org
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=http://cnpmjs.org/downloads
electron_mirror=https://npm.taobao.org/mirrors/electron/
sqlite3_binary_host_mirror=https://foxgis.oss-cn-shanghai.aliyuncs.com/
profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
chromedriver_cdnurl=https://cdn.npm.taobao.org/dist/chromedriver

.yarnrc

1
2
3
4
5
6
7
registry "https://registry.npm.taobao.org"
sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
phantomjs_cdnurl "http://cnpmjs.org/downloads"
electron_mirror "https://npm.taobao.org/mirrors/electron/"
sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/"
chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"

搭建本地 npm 镜像