重要提示: 此中文文档针对的是 Yarn 2 版本。
有关 1.x 版本的中文文档,请点击进入 yarn.bootcss.com。
Yarn
yarn addyarn binyarn cache cleanyarn config getyarn config setyarn configyarn constraints queryyarn constraints sourceyarn constraintsyarn dedupeyarn dlxyarn execyarn infoyarn inityarn installyarn linkyarn nodeyarn npm infoyarn npm loginyarn npm logoutyarn npm publishyarn npm tag addyarn npm tag listyarn npm tag removeyarn npm whoamiyarn packyarn patch-commityarn patchyarn plugin import from sourcesyarn plugin importyarn plugin listyarn plugin removeyarn plugin runtimeyarn rebuildyarn removeyarn runyarn searchyarn set resolutionyarn set version from sourcesyarn set versionyarn stageyarn unplugyarn upyarn upgrade-interactiveyarn version applyyarn version checkyarn versionyarn whyyarn workspaceyarn workspaces focusyarn workspaces foreachyarn workspaces list

yarn info

See information related to packages.

Usage

$> yarn info [-A,--all] [-X,--extra #0] [--cache] [--dependents] [--manifest] [--virtuals] [--json] ...

Examples

Show information about Lodash :

yarn info lodash

Details

This command prints various information related to the specified packages, accepting glob patterns.

By default, if the locator reference is missing, Yarn will default to print the information about all versions of the package in the active workspace dependency tree. To instead print all versions of the package in the whole project, use the -A,--all flag.

Some fields will be hidden by default in order to keep the output readable, but can be selectively displayed by using additional options:

  • The --dependents flag will print all dependents for each matching package.

  • The --manifest flag will print data obtained by looking at the package archive (license, homepage, ...).

  • The --virtuals flag will print each instance of the virtual packages.

Note that this command will only print the information directly related to the selected packages - if you wish to know why the package is there in the first place, use yarn why which will do just that (it also provides a -R,--recursive flag that may be of some help).