安装
初始化项目
yarn init
全局
yarn global <add/bin/list/remove/upgrade> [--prefix]
添加依赖包
yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]
将依赖项添加到不同依赖项类别
分别添加到devDependencies
、peerDependencies
和 optionalDependencies
:
yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional
升级依赖包
yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]
移除依赖包
yarn remove [package]
安装项目所有依赖
yarn
yarn install
yarn 设置镜像
yarn config get registry
// https://registry.yarnpkg.com
yarn config set registry https://registry.npm.taobao.org
// 出现如下命令即成功
// yarn config v0.15.0
// success Set "registry" to "https://registry.npm.taobao.org".
// Done in 0.04s.
网友评论