npm install -g yarn
安装完成后,你可以测试下自己的版本 yarn --version 或 yarn -v
开始使用
单独安装包的方式add 不是install,后面不用加 --save-dev, install是安装所有依赖包 他会自动帮你生成package的json文件记录包安装信息,如果全局安装就要加上-g yarn add gulp-less
安装package的信息包(安装所有 相当于npm install),就跟npm一样 install yarn install
常用命令
# 初始化一个项目 yarn init # 装包 yarn add packagename yarn add packagename --dev # 更新包 yarn upgrade packagename # 删除包 yarn remove packagename # 安装所有包 yarn yarn install # 发布包 yarn publish # 查看包的缓存列表 yarn cache list # 全局安装包 == npm -g yarn global