重要提示: 此中文文档针对的是 Yarn 的最新版本。
有关 1.x 版本的中文文档,请点击进入 classic.yarnpkg.cn。
Yarn
yarn addyarn binyarn cache cleanyarn config getyarn config setyarn config unsetyarn configyarn constraints queryyarn constraints sourceyarn constraintsyarn dedupeyarn dlxyarn execyarn explain peer-requirementsyarn explainyarn infoyarn inityarn installyarn linkyarn nodeyarn npm audityarn npm infoyarn npm loginyarn npm logoutyarn npm publishyarn npm tag addyarn npm tag listyarn npm tag removeyarn npm whoamiyarn packyarn patch-commityarn patchyarn plugin checkyarn 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 unlinkyarn 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 ...

Examples

Show information about Lodash :

yarn info lodash

Options

Definition
Description

-A,--all

Print versions of a package from the whole project

-R,--recursive

Print information for all packages, including transitive dependencies

-X,--extra #0

An array of requests of extra data provided by plugins

--cache

Print information about the cache entry of a package (path, size, checksum)

--dependents

Print all dependents for each matching package

--manifest

Print data obtained by looking at the package archive (license, homepage, ...)

--name-only

Only print the name for the matching packages

--virtuals

Print each instance of the virtual packages

--json

Format the output as an NDJSON stream

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 the matching direct dependencies of the package for the active workspace. To instead print all versions of the package that are direct dependencies of any of your workspaces, use the -A,--all flag. Adding the -R,--recursive flag will also report transitive dependencies.

Some fields will be hidden by default in order to keep the output readable, but can be selectively displayed by using additional options (--dependents, --manifest, --virtuals, ...) described in the option descriptions.

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).