cnpm – 淘宝的 npm 镜像
最后更新于:2022-04-02 03:41:47
[TOC]
## 安装 cnpm
1. 直接安装
```
npm install -g cnpm --registry=https://registry.npm.taobao.org
```
2. 替换别名
```
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
# Or alias it in .bashrc or .zshrc
$ 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
```
## 安装模块
`cnpm install [name]`
';