Common commands:

Create a project: YARN Init

Install dependency package: yarn == yarn install

Adding dependency packages: yarn add

View the yarn Global list

NPM: NPM list -g –depth 0


Yarn command list


The command operation parameter The label
yarn add Adding a dependency package The package name –dev/-D
yarn bin The YARN installation directory is displayed There is no There is no
yarn cache According to the cache List the cache package: ‘ls’, type the cache directory path:’ dir ‘, clear the cache: ‘clean’ There is no
yarn check Check the package
yarn clean Clean up unneeded dependency files
yarn config configuration Set: ‘set <key> <value>’, delete: ‘delete’, list: ‘list’ [-g | –global]
yarn generate-lock-entry Generate lock file There is no There is no
yarn global Global installation dependency packages yarn global <add/bin/ls/remove/upgrade> [–prefix] –prefix Indicates the prefix of the packet path
yarn info Displays information about dependent packages The package name –json: Displays the result in JSON format
yarn init Create/update package.json files interactively There is no –yes/-y: Generate package.json files with default values
yarn install Install all dependency packages –flat: only one version is installed; –force: forcibly downloads the installation again. –har: Outputs network performance logs during installation. –no-lockfile: no yarn.lock file is generated. — Production: Install dependencies in devDependencies
yarn licenses Lists the certificates for which dependency packages are installed Ls: indicates the certificate list. Generate-disclaimer: generates a disclaimer
yarn link Link dependency packages at development time for use in other projects The package name
yarn login Save your username and email address
yarn logout Delete your username, email address
yarn list Lists installed dependency packages –depth=0: list depth, starting from 0
yarn outdated Check for obsolete dependency packages The package name
yarn owner Managing owners ls/add/remove
yarn pack Package the package’s dependencies –filename
yarn publish Publish the package to NPM –tag: version tag; — Restricted = public = public
yarn remove Uninstall the package and update package.json and yarn.lock The package name
yarn run Run the predefined scripts in package.json
yarn self-update Yarn update itself — not implemented
yarn tag Displays the label of the package add/rm/ls
yarn team The management team create/destroy/add/rm/ls
yarn test Test = YARN Run test
yarn unlink Unlink dependent packages
yarn upgrade Upgrading dependency packages
yarn version Manages the version number of the current project –new-version: directly records the version number. –no-git-tag-version: no git tag is generated
yarn why Analyze why dependency packages need to be installed Package name/package directory/file name in the package directory