命令对应表
| npm | yarn | 作用 | |
| npm install | npm i | yarn | 安装 |
| npm install XXX --global | npm i XXX -g | yarn global add XXX | 全局安装 |
| npm install XXX @y.y.y | npm i XXX @y.y.y | yarn add XXX @y.y.y | 安装指定版本 |
| npm install XXX --save | npm i XXX -S | yarn add XXX | 生产模式安装包 |
| npm install XXX --save-dev | npm i XXX -D | yarn add XXX --dev | 开发模式安装包 |
| npm uninstall XXX --save | yarn remove XXX | 卸载 | |
| npm update --save | yarn update | 更新 | |
| npm --version | yarn --version | 查看版本 | |
| npm config get registry | yarn config get registry | 查看镜像源 | |
| npm config set registry https://registry.npm.taobao.org | yarn config set registry https://registry.npm.taobao.org | 设置镜像源 | |
原文:https://www.cnblogs.com/simonalwayson/p/14421944.html