Yarn常用命令使用

JavaScript · 2024-02-21

安装及初始化

安装

npm install --global yarn
npm install yarn -g

配置镜像源

yarn config set registry https://registry.npm.taobao.org
yarn config get registry

版本查看

yarn --version
yarn -v

初始化一个新项目并创建package.json文件

yarn init

依赖包

安装己有依赖

yarn 
yarn install

添加依赖包

yarn add [package]
yarn add [package]@[version]
yarn global add [package]

升级依赖包

yarn upgrade [package]
yarn upgrade [package]@[version]

删除依赖包

yarn remove [package]

已经安装的列表

yarn list

运行命令

yarn run [command]

配置信息

查看

yarn config list

设置

yarn config set 
yarn config set registry https://registry.npm.taobao.org

缓存

查看列表

yarn cache list

清除缓存

yarn cache clear

更多命令

yarn add
yarn audit
yarn autoclean
yarn bin
yarn cache
yarn check
yarn config
yarn create
yarn dedupe
yarn generate-lock-entry
yarn global
yarn help
yarn import
yarn info
yarn init
yarn install
yarn licenses
yarn link
yarn list
yarn lockfile
yarn login
yarn logout
yarn outdated
yarn owner
yarn pack
yarn policies
yarn prune
yarn publish
yarn remove
yarn run
yarn self-update
yarn tag
yarn team
yarn test
yarn unlink
yarn upgrade
yarn upgrade-interactive
yarn version
yarn versions
yarn why
yarn workspace
yarn workspaces
Theme Jasmine by Kent Liao