npm registry淘宝镜像

淘宝npm镜像10分钟同步一次,确保与npmjs.org保持一致。

指定镜像

方式一:

$ npm install -g cnpm --registry=https://registry.npm.taobao.org

方式二:

alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"

或者

$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
  --cache=$HOME/.npm/.cache/cnpm \
  --disturl=https://npm.taobao.org/dist \
  --userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc

验证

npm config get registry

输出:

https://registry.npmjs.org/

cnpm config get registry

输出:

https://registry.npm.taobao.org/

用法

使用原始镜像:

$ npm install [name]

使用指定镜像:

$ cnpm install [name]

镜像同步

同步命令:

$ cnpm sync connect

web方式:

通过/sync/connect或执行如下命令:

$ open https://npm.taobao.org/sync/connect

开源镜像列表

registry.npm.taobao.org

r.cnpmjs.org

开源镜像:

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/