# yarn命令

# 初始化

yarn init
1

# 依赖

# 安装

安装项目全部依赖

yarn
# or
yarn install
1
2
3

# 添加

yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
1
2
3

将依赖项添加到不同依赖项类别中

分别添加到 devDependenciespeerDependenciesoptionalDependencies 类别中:

yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional
1
2
3

# 升级

yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]
1
2
3

# 移除

yarn remove [package]
1