yarn 与 npm 功能对应表格:
初始化 | yarn init | npm init |
安装项目所有包(注意) | yarn | npm install |
添加 dependencies | yarn add [package-name] | npm install [package-name] --save |
添加 devDependencies | yarn add [package-name] --dev | npm install [package-name] --save-dev |
删除 dependencies | yarn remove [package-name] | npm uninstall [package-name] --save |
删除 devDependencies | yarn remove [package-name] --dev | npm uninstall [package-name] --save-dev |
全局安装 | yarn global add [package-name] | npm install [package-name] -g |
运行 | yarn run | npm run |